Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP errors on 5.4.43 #42

Open
tdmalone opened this issue May 6, 2016 · 1 comment
Open

PHP errors on 5.4.43 #42

tdmalone opened this issue May 6, 2016 · 1 comment

Comments

@tdmalone
Copy link

tdmalone commented May 6, 2016

I know this plugin requires at least PHP 5.3 due to its use of closures and namespaces, but are there any known compatibility issues beyond that?

I was able to use it fine on a server running PHP 5.5.15, but on another server with PHP 5.4.43 I get the following errors when WP_DEBUG is on (the errors only come up once this plugin is activated and disappear again when it is deactivated):

  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 925
  • Notice: Undefined offset: 0 in ..../wp-includes/plugin.php on line 943
  • Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in ..../wp-includes/plugin.php on line 525

In addition, on this server, the widget is not available, and I also noticed the admin menu item appears up amongst the posts (below Pages) whereas it is between Tools and Settings on the PHP 5.5.15 server, where it functions correctly.

@tdmalone
Copy link
Author

I was able to solve this for now by changing a bunch of filters and one action to call defined functions rather than anonymous functions.

Following are all the filter/action calls I found I needed to change. They're all called in plugin.php:

  • dfp_ads_menu_position
  • dfp_ads_metabox_fields
  • dfp_ads_settings_sections
  • dfp_ads_settings_fields
  • dfp_ads_import_sections
  • dfp_ads_import_fields
  • widgets_init

I'm still not sure exactly what is causing this problem as I can't see any reason why PHP 5.4.43 shouldn't fully support anonymous functions, and I'm not sure that I've caught all the ones which were having issues either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant