xwp / wp-customize-snapshots

Customize Snapshots WordPress Plugin
https://wordpress.org/plugins/customize-snapshots/
52 stars 11 forks source link

Exception thrown when attempting to activate plugin on windows environment #105

Closed dmalshin closed 7 years ago

dmalshin commented 7 years ago

Can't activate the plugin due to a fatal error. Tested on two different websites, on WP 4.7 and on the previous WP version. 2bf6bdc744

westonruter commented 7 years ago

Note: The plugin is not yet compatible with WordPress 4.7.

That being said, this error should not be happening on 4.7 or any previous version.

westonruter commented 7 years ago

The (attempted) exception being thrown is:

Plugin dir is not inside of the wp-content directory

See https://github.com/xwp/wp-customize-snapshots/blob/629033dd3704945aa78e72986441425925c1b1a2/php/class-plugin-base.php#L152

It seems that the plugin is having a hard time locating itself on your Windows filesystem.

awps commented 7 years ago

As well. I can't activate it. Looke like this plugin does not have support for symlinks. Also, is not a good method to extend a class like this:

class Exception extends \Exception {}

IMHO, something like this this is better:

class DoException extends \Exception {}

I would love to see this fixed. Should I do a contribution?

screen-0001

westonruter commented 7 years ago

@Smartik89 the name of the exception is fine and is as intended, since it is being namespaced. Please do open a PR with a fix for the symlink issue.

Alexander-Shukaev commented 7 years ago

I have the same issue on Linux:

[15-Jul-2017 13:34:30 UTC] PHP Fatal error:  Uncaught Error: Class 'CustomizeSnapshots\Exception' not found in /.../wp-content/plugins/customize-snapshots/php/class-plugin-base.php:152
Stack trace:
#0 /.../wp-content/plugins/customize-snapshots/php/class-plugin-base.php(71): CustomizeSnapshots\Plugin_Base->locate_plugin()
#1 /.../wp-content/plugins/customize-snapshots/php/class-plugin.php(56): CustomizeSnapshots\Plugin_Base->__construct()
#2 /.../wp-content/plugins/customize-snapshots/instance.php(15): CustomizeSnapshots\Plugin->__construct()
#3 /.../wp-content/plugins/customize-snapshots/customize-snapshots.php(33): require_once('...')
#4 /.../wp-admin/includes/plugin.php(1882): include('...')
#5 /.../wp-admin/plugins.php(164): plugin_sandbox_scrape('customize-snaps...')
#6 {main}
  thrown in /.../plugins/customize-snapshots/php/class-plugin-base.php on line 152

Not a PHP expert at all but a quick search suggests this.

westonruter commented 7 years ago

Please test fix in #139.

Alexander-Shukaev commented 7 years ago

You can go ahead with the merge, confirmed. Thank you.