php7.2 Deprecated: Function create_function() is deprecated
-
I just migrated php to 7.2 and reviewing all installed plugins. I do have problems with your plugin:
Deprecated: Function create_function() is deprecated in disable-user-gravatar/disable-user-gravatar.php on line 35
add_filter('user_profile_picture_description', create_function('$desc', 'return "";'));
This should be really easy to fix by using an anonymous function or a utility function of WordPress:
add_filter('user_profile_picture_description', '__return_empty_string' );
I have tested this by modifying the filter to always return “Hello World”. After this I verified the behaviour by looking under a profile picture and “Hello World” was printed.
Then I applied my Patch to use'__return_empty_string'
. After this there is no output there.1. I’m not sure if
__return_empty_string
is appropriate because of the parameters. But I don’t get an error complaining about missing parameters of__return_empty_string
.
2. According to the user_profile_picture_description hook there is a second parameter$profileuser
since WordPress 4.7.0. This one is missing in your current implementation by the way.Target WordPress version: since this fix uses
__return_empty_string
which was introduced in 3.7.0 the target version might increase. If this is not acceptable just use a anonymous function.Please note: you use
__return_true
which was introduced in 3.0.0. But the plugin min version is 2.7.0. Please increase to at least 3.0.0.
- The topic ‘php7.2 Deprecated: Function create_function() is deprecated’ is closed to new replies.