Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Upgrading Ubuntu server to 22.02 and PHP version to 8.1 gives `spl_autoload_register()` error

Solved by Sebastian Gonzato View solution

Started by Sebastian Gonzato 2 years ago · 5 replies · 469 views
2 years ago

I upgraded my Ubuntu server from 18.02 to 22.02 and my PHP version to 8.3 (from 7.4). This then gave me the following error:

TXT
Whoops \ Exception \ ErrorException (E_NOTICE)
spl_autoload_register(): Argument #2 ($do_throw) has been ignored, spl_autoload_register() will always throw

You can see the full error on my site and I've also attached a screenshot.

I thought that downgrading to PHP version 8.1 might help, as would removing the shortcode plugin, but no, same error :-( Any ideas?

Additional context:

  • System output log just gives me the same error: spl_autoload_register(): Argument #2 ($do_throw) has been ignored, spl_autoload_register() will always throw
  • Grav admin panel works, my actual website does not
  • I'm running Nginx
  • Tools -> Reports does not indicate any errors
  • These two questions are the most relevant to my problem, but did not help:

/forum/support/upgrading-from-php7-4-to-php8-1-t8911

/forum/general/server-error-e-notice-spl-autoload-register-t4594

image|690x415

last edited 06/25/24 by Sebastian Gonzato
2 years ago

Hi @Karmalakas ! Yes I have (read the pinned topic and searched the forum). I will admit though that I am not keen on creating an MWE, since this would be quite some effort for me. I have updated the post to provide more context.

2 years ago Solution

Yes there are - Media Embed, last updated from 2017. I disabled it and everything is fine now 🙂 So I guess this is a general rule, some plugins may break Grav when updated PHP versions.

2 years ago

It makes ense, that old outdated plugins use PHP features, that are no longer supported on newer PHP versions. You could raise an issue on GitHub plugin repo. Might get updated if plugin author is up for it

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 9 hours ago
General · by pamtbaau, 14 hours ago
1 51 14 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago