• Resolved rohans

    (@rohans)


    I updated the dev environment of the website with the latest version of both plugins. The site now crashes.

    The site is running PHP version 7.4.
    Autodescription is version 5.0.6
    The seo framework extension manager is version 2.6.3

    The readme.txt files clearly states that PHP 7.4 and up is supported. What is I don’t understand is why does site/public/wp-content/plugins/the-seo-framework-extension-manager/bootstrap/load.php contain str_starts_with, since this is a PHP 8 function.

    Error log in debug.log
    ———————-

    [23-Sep-2024 10:49:12 UTC] : Uncaught Error: Class ‘Symfony\Polyfill\Php80\Php80’ not found in /site/vendor/symfony/polyfill-php80/bootstrap.php:32

    Stack trace:PHP Fatal error

    #0 /site/public/wp-content/plugins/the-seo-framework-extension-manager/bootstrap/load.php(278): str_starts_with(‘symfony\\polyfil…’, ‘tsf_extension_m…’)

    #1 [internal function]: TSF_Extension_Manager\_autoload_classes(‘symfony\\polyfil…’)

    #2 /site/vendor/symfony/polyfill-php80/bootstrap.php(32): spl_autoload_call(‘Symfony\\Polyfil…’)

    #3 /site/public/wp-content/plugins/the-seo-framework-extension-manager/bootstrap/load.php(278): str_starts_with(‘qm_dispatchers’, ‘tsf_extension_m…’)

    #4 [internal function]: TSF_Extension_Manager\_autoload_classes(‘qm_dispatchers’)

    #5 /site/public/wp-content/plugins/query-monitor/collectors/php_errors.php(318): spl_autoload_call(‘QM_Dispatchers’)

    #6 /site/public/wp-content/plugins/query-monitor/collectors/php_er in /site/vendor/symfony/polyfill-php80/bootstrap.php on line 32

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Howdy!

    str_starts_with() is indeed a PHP 8 function, but WordPress has polyfilled this function in WP v5.9:
    https://github.com/WordPress/wordpress-develop/blob/5.9.0/src/wp-includes/compat.php#L438-L457.

    The SEO Framework plugins require WP 5.9 or higher, but these restrictions can be bypassed using CLI. Are you using an earlier WordPress version?

    Thread Starter rohans

    (@rohans)

    Hi

    I am on WP 6.2.3.

    Plugin Author Sybre Waaijer

    (@cybr)

    Ah, that’s odd!

    Do you know which plugin or file has added the Symfony polyfill?

    I find /site/vendor/symfony/polyfill-php80/bootstrap.php an odd path for WordPress, which doesn’t come with a /vendor/ directory. Perhaps this is coming from the developer’s environment, which didn’t correctly implement the Symfony bootstrap.

    What system are you using for the development environment? It may have an update ready that resolves this issue.

    The file is probably included/required via /site/public/wp-config.php or /site/public/index.php; it would look a bit like this:

    require '/vendor/symfony/polyfill-php80/bootstrap.php';
    

    WordPress provides its own forward compatibility polyfills, and embedding another system like Symfony isn’t helpful. So, I recommend removing that line if you can find it.

    Alternatively, you could probably resolve this by adding the following code line to the /site/vendor/symfony/polyfill-php80/bootstrap.php file on line 17:

    include 'Php80.php';
    

    However, the easiest solution is to use PHP 8.1, which I recommend upgrading to because all older versions are no longer maintained, not even for security updates: https://www.php.net/supported-versions.php.

    Thread Starter rohans

    (@rohans)

    The site structure is not standard but has been developed for our own requirements and is used by a large number of our client sites. A major requirement is that we add components and plugins through Composer. https://roots.io/bedrock/ does something similar.

    So, I don’t specifically add Symfony polyfill; it’s added automatically by Composer since some other plugins require it. Because of that, I can’t just delete it either.

    For some reason, it’s only your two plugins that throw this error. We have not seen it thrown anywhere else.

    Thread Starter rohans

    (@rohans)

    I’ve managed to get past this problem. The site was running WordPress 6.2.3. When I update WordPress to anything above 6.3.0, the site works and the error disappears. It does not explain why it’s breaking, but at least I can continue.

    Thanks for the assistance.

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi again!

    I tend to keep up with the latest coding standards and features since I pursue efficiency and performance. This would explain why only my plugins are facing this issue… for now.

    WordPress 6.3 loads its forward-compatibility files much earlier than before, namely in the index.php file (and a fall-through at wp-load.php for wp-admin.php requests), where it used to load in the late wp-settings.php: https://github.com/WordPress/wordpress-develop/commit/3349f1a527761eed3aa2d48050d80a9b62fc6860#diff-67bc547cb802249d43973495f241371aa7b0282ce8547efc881d2ee11e8e0d64R25.

    This eliminates the need for Symfony to load its apparently incorrect implementation via Composer.

    That was an interesting find ?? I hope this explains everything to the letter… or byte. Cheers!

    Thread Starter rohans

    (@rohans)

    Thanks for your help. Great support!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.