简体   繁体   中英

Deprecated: Function create_function() is deprecated in /var/www/wordpress/wp-includes/plugin.php on line 446

A client site is showing these errors on repeatedly on several lines

Deprecated: Function create_function() is deprecated in /var/www/wordpress/wp-includes/plugin.php on line 446

Deprecated: Function create_function() is deprecated in /var/www/wordpress/wp-includes/plugin.php on line 451

Deprecated: Function create_function() is deprecated in /var/www/wordpress/wp-includes/plugin.php on line 456

Upon investigating, I realized most people who had this error had it after upgrading their php version or it was specifically for a particular plugin, but in this case, it iOS not for a particular plugin neither was the php version upgraded(at least to the best of my knowledge)

435 function do_action( $hook_name, ...$arg ) {
436         global $wp_filter, $wp_actions, $wp_current_filter;
437
438         if ( ! isset( $wp_actions[ $hook_name ] ) ) {
439                 $wp_actions[ $hook_name ] = 1;
440         } else {
441                 ++$wp_actions[ $hook_name ];
442         }
443
444         // Do 'all' actions first.
445         if ( isset( $wp_filter['all'] ) ) {
446                 $wp_current_filter[] = $hook_name;
447                 $all_args            = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCur$
448                 _wp_call_all_hook( $all_args );
449         }
450
451         if ( ! isset( $wp_filter[ $hook_name ] ) ) {
452                 if ( isset( $wp_filter['all'] ) ) {
453                         array_pop( $wp_current_filter );
454                 }
455
456                 return;
457         }

Here is the snippet of the create_function() throwing the error. I am not really sure what the problem is but I am suspecting the hook_name.

Other information PHP 7.2.24-0 ubuntu0.18.04.15

The create_function is deprecated from PHP v7.2.0 your version is v7.2.24-0 that's why it's showing deprecated log.

https://www.php.net/manual/en/function.create-function.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM