wordpress-sdk icon indicating copy to clipboard operation
wordpress-sdk copied to clipboard

Check preg_match success before using matches

Open jhard opened this issue 2 years ago • 0 comments

Caught an error E_WARNING in wp-content/plugins/tablepress/libraries/freemius/includes/class-freemius.php:14526 Undefined array key 1

14518                                         if ( is_network_admin() ) {
14519                                                 preg_match( '#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
14520                                         } else if ( is_user_admin() ) {
14521                                                 preg_match( '#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
14522                                         } else {
14523                                                 preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
14524                                         }
14525 
14526                                         $pagenow = $self_matches[1];

Please check that $self_matches actually contains matches.

jhard avatar May 29 '23 12:05 jhard