Lewiscowles1986 / WordPressSVGPlugin

WordPress SVG Plugin
GNU General Public License v3.0
42 stars 4 forks source link

[BUG] Version 2.1.3 causes PHP Fatal Error #43

Closed marcustallberg closed 3 years ago

marcustallberg commented 3 years ago

Describe the bug

Bump from version 2.1.2 -> 2.1.3 causes PHP Fatal Error. Same behaviour on three different sites.

The Context

PHP Fatal error: Uncaught Error: Class 'lewiscowles\Plugins\EnableSVG\lewiscowles\WordPress\Compat\FileTypes\SVGSupport' not found in /var/www/html/wp-content/plugins/enable-svg-uploads/index.php:42

Stack trace:

0 /var/www/html/wp-settings.php(391): include_once()

1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): require('/var/www/html/w...')

2 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1158): WP_CLI\Runner->load_wordpress()

3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()

4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))

5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()

6 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')

7 /usr/local/bin/wp(4): include('phar:///usr/loc...')

8 {main}

thrown in /var/www/html/wp-content/plugins/enable-svg-uploads/index.php on line 42

To Reproduce

Steps to reproduce the behaviour: Install latest version of plugin

Expected behaviour

Expectation is that plugin would work. Rolling back to version 2.1.2. eliminates problem.

Lewiscowles1986 commented 3 years ago

Apologies, I'll dig into this, it is likely something to do with the github action used to deploy as all I changed was the supported version header.

Lewiscowles1986 commented 3 years ago

Can you give more specific examples? I just set this up by downloading the zip and installing on a 5.7.2 site.

What wp-cli command are you running? Can you work with me to see this through to resolution?

marcustallberg commented 3 years ago

I don't think wp-cli is related to error, it was only a way to get a more detailed error message when /wp-admin was unreachable. The command however was wp plugin list.

This manifested itself by the plugin being set to self-update automatically.

Lewiscowles1986 commented 3 years ago

Do you think if I prepare an asset for you to test you would be able to confirm if it breaks your setup before I release to wp-dot-org? (I already know it doesn't break mine, and I don't know, but can guess why it might be breaking yours)

Lewiscowles1986 commented 3 years ago

enable-svg-uploads.2.1.3.zip

Here's the asset, it's a modified index.php with changed version check (not related to this issue) and re-ordering of require.

I am sorry this broke your site, and will try to do better in-future. This is uploaded to a host and manually tested through to uploading an SVG, so I don't quite know how I missed this.

Lewiscowles1986 commented 3 years ago

All this and it was a missing \

I found if I clear the caching layer my site captures the error too.

Lewiscowles1986 commented 3 years ago

2.1.4 coming at you with the fix :+1:

marcustallberg commented 3 years ago

The zip package you provided earlier still raises an error:

Screenshot 2021-05-29 at 8 21 59
Lewiscowles1986 commented 3 years ago

Can you check the version from wordpress.org?

If it's broken, I'll dig into it more, but I've just installed it across three sites and uploaded SVG's. One of the sites has never used this plugin before.

marcustallberg commented 3 years ago

Wordpress version: 5.7.2

And now I can confirm the following when testing the different versions: 2.1.4 works 2.1.3 breaks the site 2.1.2 works

Lewiscowles1986 commented 3 years ago

I added a note to the plugin directory page apologizing for 2.1.3, and providing 2.1.4. I'll close this now as 2.1.4 can now receive auto-updates and is protected against this issue. It is strange the 2.1.3 didn't work, but perhaps the manual editing of the zip file didn't fix.

Thanks for your patience and understanding.