Acorn Illuminate Fatal error

Hi there,

On my live site I’ve started getting the following server error which is causing long delays in Server response:

PHP Fatal error: Declaration of Illuminate\Container\Container::has($id) must be compatible with Psr\Container\ContainerInterface::has(string $id)

My server slow log also highlights a bunch of other errors & warnings:

[0x00007f3242e16300] curl_exec() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/Requests/src/Transport/Curl.php:204

[0x00007f3242e16220] request() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/Requests/src/Requests.php:469

[0x00007f3242e16120] request() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/class-wp-http.php:396

[0x00007f3242e15f90] request() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/class-wp-http.php:634

[0x00007f3242e15ef0] get() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/http.php:162

[0x00007f3242e15e60] wp_remote_get() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/leaflet-maps-marker-pro/inc/showmap.php:1706
//Line info: load gpx_content
$gpx_content_array = wp_remote_get( $gpx_url, array( "sslverify" => false, "timeout" => 30 ) );

[0x00007f3242e148b0] [INCLUDE_OR_EVAL]() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/leaflet-maps-marker-pro/inc/showmap_prepare.php:2

[0x00007f3242e14780] [INCLUDE_OR_EVAL]() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/leaflet-maps-marker-pro/leaflet-core.php:2

[0x00007f3242e146e0] lmm_showmap() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/shortcodes.php:355

[0x00007f3242e145f0] do_shortcode_tag() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/shortcodes.php:227

[0x00007f3242e14570] preg_replace_callback() /var/www/vhosts/mysite.com/httpdocs/wp/wp-includes/shortcodes.php:227

[0x00007f3242e14490] do_shortcode() /var/www/vhosts/mysite.com/httpdocs/wp-content/cache/acorn/framework/views/d41b6fa0c870d1e335a6532a2f313193a982459e.php:9

[0x00007f3242e14410] [INCLUDE_OR_EVAL]() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/filesystem/Filesystem.php:107

[0x00007f3242e14390] Illuminate\Filesystem\{closure}() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/filesystem/Filesystem.php:108

[0x00007f3242e142c0] getRequire() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/view/Engines/PhpEngine.php:58

[0x00007f3242e14220] evaluatePath() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/view/Engines/CompilerEngine.php:61

[0x00007f3242e14190] get() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/view/View.php:139

[0x00007f3242e14130] getContents() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/view/View.php:122

[0x00007f3242e140c0] renderContents() /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/acorn/vendor/illuminate/view/View.php:91

[0x00007f3242e14010] render() /var/www/vhosts/mysite.com/httpdocs/wp-content/cache/acorn/framework/views/7f93c170d9c034585d602480513121c1abce2dc1.php:10

Does this look like a plugin conflict between Acorn and Leaflet Maps Marker? What I’m struggling to understand is why our staging site using the exact same setup runs flawlessly. I’ve read some posts talking about PSR log version but is there anything else I should be looking for here?

I’m running:
Sage 10.2.0
(No Bedrock)
Composer 2.1.14 (Basic composer.json - no added plugins)
PHP 7.4.28
Acorn 2.1.2 (Loaded as a regular plugin)
WP 6.2

PHP Extensions:
Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, intl, json, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mysqli, pdo_mysql, pdo_sqlite, xmlreader, apcu, igbinary, imagick, msgpack, zip, redis, Zend OPcache

Any help would be awesome

Many thanks

Marco

Very likely if Leaflet Maps Marker includes psr/log without taking into consideration that other plugins might also be trying to include it. Plugins really need to be using something like GitHub - humbug/php-scoper: 🔨 Prefixes all PHP namespaces in a file/directory to isolate the code bundled in PHARs. to avoid this issue — it doesn’t apply to Acorn since Acorn is a proper Composer package.

Did you try including different versions of psr/log from the same spot that you’re requiring Acorn? That should resolve your issue

composer require psr/log 2.0

Hi Ben,

Many thanks for the quick reply!

I installed Acorn via the WP Plugins directory (version 2.11) so I’m not sure where I’m requiring Acorn from? The link to the v2 docs now redirects to v3 :slight_smile: Is there anyway to view the older docs?

Re the PSR log, would I need to edit a file within the plugin folder or should i be installing the plugin via composer? I’m not running PHP8 at present so can’t migrate to v3 yet.

I have only the slightest grasp on all this so please excuse my ignorance and thanks again for your help

Are you able to install Acorn v2 via Composer instead of as a WP plugin?

The Acorn v3 docs are almost the exact same as v2 except that we no longer support installing Acorn as a WP plugin

If you’re unable to install Acorn via Composer then it’s gonna be a bit tricky to fix this issue because it will require you to manually modify files related to psr/log, either within Acorn or within the conflicting plugin

I’ll try installing via Composer though I’m seeing a million different ways to install a specific package version! Would it be:

composer require roots/acorn:2.1.2

Do I run the install from the Theme directory since I’m not using Bedrock?
Do I need to remove the WP Plugin version first?

Yes to all three :+1:

You’ll also want to add the post-autoload-dump event to the theme’s composer.json per the docs

Thanks for your help Ben. Issue fixed.

Running Acorn as a composer package and the post-autoload-dump event did the trick. No more errors and didn’t have to add other psr/logs.

1 Like