plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Getting this error when running PUC scoped by PHP Scoper

Open xoich opened this issue 4 years ago • 3 comments

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()

xoich avatar Sep 29 '21 09:09 xoich

Here are some ideas:

  • Does this only happen if you add a custom namespace to the update checker?
  • Is the plugin file name correct? Ideally, it should be the full path to the plugin file, not a relative path.
  • 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.
  • 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.

YahnisElsts avatar Sep 30 '21 15:09 YahnisElsts

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.

xoich avatar Oct 04 '21 14:10 xoich

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)?

  • If it's the second argument then that's most likely wrong. You should use the full path to the main plugin file instead.
  • If it's the third argument then that's probably fine. The slug just needs to be unique.

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().

YahnisElsts avatar Oct 11 '21 15:10 YahnisElsts