FortAwesome / wordpress-fontawesome

Font Awesome Official WordPress Plugin
Other
57 stars 19 forks source link

Bug: major incompatibility with php 8.2 #214

Open NicktheGeek opened 5 months ago

NicktheGeek commented 5 months ago

I'm still working to understand exactly what happened here so I'll add as much detail as possible in the hope that maybe someone knows some part of the code that could have triggered this.

A few weeks ago we started using this plugin on a client site and also updated to PHP 8.2. There were some warnings thrown but otherwise everything worked in our testing and continued to work for a few weeks.

Then 2 days ago the site went down. Some pages would partially load and other pages failed to load at all. For example, the login page threw a 502 error.

The debug logs did not shed any light on the issue. NGINX showed that PHP was exiting prematurely with an error but the PHP logs didn't record the error.

The only thing I could do to diagnose was log in via SFTP to try and figure out where it was halting. Eventually I renamed the plugins directory and the site was loading better though some functions no longer existed but at least that provided errors that were not found previously.

I restored the directory name and everything broke again.

So I went through each plugin renaming the directory until the font-awesome plugin. As soon as I renamed it, the entire site was back up except icons didn't work because the plugin wasn't loading.

Again, this worked in PHP 8.2 for weeks, but something triggered an error state in such a way that PHP failed before it could record the error.

The only other bit of diagnostic info I have so far is that there was a sister site we still had on PHP 8.0 because some issues with the login had to be resolved before updating. The code is mostly the same including this plugin. It never had an issue so I reactivated the font awesome plugin after rolling back the site that broke to PHP 8.0 and everything is working perfectly again.

So there appears to be some code that is triggered intermittently that breaks in such a way in PHP 8.2 that I could not get any debug info.

I hope this might trigger some idea because I'm at a loss currently.

robmadole commented 5 months ago

Thanks, @NicktheGeek. That's surprising. The part that gets me is that it worked for weeks. That seems to point me toward some state issue (data in the database).

I don't even know how we go about trying to reproduce this...

I think the best thing we can do is leave this issue open and maybe someone else runs into it and we can gather more information.

JeremyShapiro commented 4 months ago

Yeah, we experienced the exact same issue... Site started generating 502 gateway errors out of nowhere. Nothing had changed. Disabling just the font awesome plugin immediately fixed it. Re-enabling the plugin immediately brought back the gateway errors.

PHP 8.2 WP 6.5.3 FA 4.4.0

EricTendian commented 4 months ago

There's an open PHP issue that is likely related: https://github.com/php/php-src/issues/13817

I'm not sure what in this plugin causes the issue, but it seems like a fix is being developed per the latest comments. It would be good to validate that possible fix against a site with this plugin enabled.

robmadole commented 4 months ago

Has anyone tried 8.2.19? That was released on May 9th.

mlwilkerson commented 4 months ago

I went to try and reproduce this using the wordpress:6-php8.2 docker image. The container says it's using PHP 8.2.8 with WordPress 6.5.3.

It's a clean and simple dev environment setup with nothing fancy. Everything seems to working as expected, based on some basic page loading usage, and running all of the PHPUnit tests.

If there's any more specific known combination of server configuration or usage that's known to trigger the error, I could try again to reproduce it.

scottbuscemi commented 4 months ago

@mlwilkerson Reproducing requires something to use the Observability API of PHP (https://github.com/php/php-src/issues/13817). Installing and activating New Relic on your server should repro.