Skip to content

Misc code fixes #27

@gRegorLove

Description

@gRegorLove
  • Check usage of mf2 helper utils like Mf2helper\getPlaintextArray() for $fallback parameter.
  • Check preg_replace deprecated usage: "PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated"
  • Check for null hostnames when error receiving webmentions. E.g. from ProcessWebmentionManager.module:
            $webmention_hostname = parse_url($webmention->url, PHP_URL_HOST);
            if ($webmention_hostname) {
                $webmention_hostname = preg_replace('#^www\.(.+\.)#i', '$1', $webmention_hostname);
            }
  • Need to check if location header is a string instead of array. This may go away with updated usage of WireHttp class, but this hotfix should also work currently:
                    $location = null;
                    if (is_string($http_headers['location'])) {
                        $location = $http_headers['location'];
                    } elseif (is_array($http_headers['location'])) {
                        $location = array_pop($http_headers['location']);
                    }

                    if ($location) {
                        $source = Mf2\resolveUrl($source, $location);
                    }
  • Calls to $sanitizer->url() should include option 'convertEncoded' => false. Hotfix for Bridgy Fed URLs that have intentionally url-encoded # (%23). Hotfixed in class WebmentionItem and in main processWebmention(), check for other usage.
  • Check length of source and target URL. May currently be limited to 255 but should be longer. Example Bridgy URL: https://brid.gy/comment/bluesky/did:plc:ofwzo2gyeln4p2pz4zuo6yno/at%253A%252F%252Fdid%253Aplc%253Aofwzo2gyeln4p2pz4zuo6yno%252Fapp.bsky.feed.post%252F3kcod6pfy6e2h/at%253A%252F%252Fdid%253Aplc%253Aofwzo2gyeln4p2pz4zuo6yno%252Fapp.bsky.feed.post%252F3kcod6pfy6e2h
  • check usage of xmlrpc_encode_request() for pingback. Not available in default PHP install. Maybe just drop sending pingback as a fallback?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions