From c191efeac69aa3c7d620ae33e19b8007eef20b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20B=C3=BCltge?= Date: Thu, 10 Jun 2021 08:33:52 +0200 Subject: [PATCH] Fix for empty var, #52 --- inc/class-all_hooks.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/class-all_hooks.php b/inc/class-all_hooks.php index df43cb4..c727631 100755 --- a/inc/class-all_hooks.php +++ b/inc/class-all_hooks.php @@ -159,13 +159,15 @@ function record_hook_usage( $hook ) { ) ); $str_replace = $doc_root . preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ); - $file_name = addslashes( str_replace( $str_replace, '', $callstack[3]['file'] ) ); - $line_num = $callstack[3]['line']; - + $file_name = __( 'Unavailable file', parent :: get_plugin_data() ); + if ( ! isset( $callstack[3]['file'] ) ) + $file_name = addslashes( str_replace( $str_replace, '', $callstack[3]['file'] ) ); + $file_num = __( 'Unavailable line', parent :: get_plugin_data() ); + if ( ! isset( $callstack[3]['line'] ) ) + $line_num = $callstack[3]['line']; + $called_by = $callstack[4]['function'] . '()'; if ( ! isset( $callstack[4] ) ) $called_by = __( 'Undefinded', parent :: get_plugin_data() ); - else - $called_by = $callstack[4]['function'] . '()'; $wpdb -> query( "INSERT " . parent::$table . " (first_call,called_by,hook_name,hook_type,arg_count,file_name,line_num)