YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.25k stars 410 forks source link

Getting this error when running PUC scoped by PHP Scoper #464

Open xoich opened 3 years ago

xoich commented 3 years ago
The update checker cannot determine if
 "/wordpress/wp-content/plugins/my-plugin/my-plugin.php" 
is a plugin or a theme. This is a bug. Please contact the PUC developer. #0 
MyPluginScope\Puc_v4p11_Factory::buildUpdateChecker()
YahnisElsts commented 3 years ago

Here are some ideas:

xoich commented 3 years ago

Does this only happen if you add a custom namespace to the update checker?

No.

Is the plugin file name correct? Ideally, it should be the full path to the plugin file, not a relative path.

I'm not entirely sure if that is what you are asking, but the plugin is in wp-content/plugins/my-plugin/my-plugin.php and I pass 'my-plugin' to buildUpdateChecker

Does the plugin file contain a valid plugin header? It must have at least a Plugin Name header, and Version is probably also required for the update checker to actually be useful.

yes

Is any part of the path a symbolic link? Those have caused problems in the past. I think I fixed some of the issues, but it's possible that I have missed something.

Yes, it's a bitnami installation and at least wp-content is a symbolic link.

YahnisElsts commented 3 years ago

I'm not entirely sure if that is what you are asking, but the plugin is in wp-content/plugins/my-plugin/my-plugin.php and I pass 'my-plugin' to buildUpdateChecker

Do you mean that you literally pass the string 'my-plugin' to buildUpdateChecker()? Is that for the plugin path (second argument) or the slug (third argument)?

Yes, it's a bitnami installation and at least wp-content is a symbolic link.

It would make debugging easier if I could reproduce this issue locally. Are you using a prebuilt VM image or something else that that would be straightforward to set up? Can you share the update checker initialization code?

If that's not feasible, I would recommend to try debugging the buildUpdateChecker() and isPluginFile() method yourself. Specifically, it would be useful to know what the $fullPath variable contains after it gets normalized, and which return statement is executed in isPluginFile().