Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -879,18 +879,35 @@ |
880 | 880 | * murky circumstances, which may be triggered in part by stub objects |
881 | 881 | * or other fancy talkin'. |
882 | 882 | * |
883 | | - * Will return an empty array if Zend Optimizer is detected, otherwise |
884 | | - * the output from debug_backtrace() (trimmed). |
| 883 | + * Will return an empty array if Zend Optimizer is detected or if |
| 884 | + * debug_backtrace is disabled, otherwise the output from |
| 885 | + * debug_backtrace() (trimmed). |
885 | 886 | * |
886 | 887 | * @return array of backtrace information |
887 | 888 | */ |
888 | 889 | function wfDebugBacktrace() { |
| 890 | + static $disabled = null; |
| 891 | + |
889 | 892 | if( extension_loaded( 'Zend Optimizer' ) ) { |
890 | 893 | wfDebug( "Zend Optimizer detected; skipping debug_backtrace for safety.\n" ); |
891 | 894 | return array(); |
892 | | - } else { |
893 | | - return array_slice( debug_backtrace(), 1 ); |
894 | 895 | } |
| 896 | + |
| 897 | + if ( is_null( $disabled ) ) { |
| 898 | + $disabled = false; |
| 899 | + $functions = explode( ',', ini_get( 'disable_functions' ) ); |
| 900 | + $functions = array_map( 'trim', $functions ); |
| 901 | + $functions = array_map( 'strtolower', $functions ); |
| 902 | + if ( in_array( 'debug_backtrace', $functions ) ) { |
| 903 | + wfDebug( "debug_backtrace is in disabled_functions\n" ); |
| 904 | + $disabled = true; |
| 905 | + } |
| 906 | + } |
| 907 | + if ( $disabled ) { |
| 908 | + return array(); |
| 909 | + } |
| 910 | + |
| 911 | + return array_slice( debug_backtrace(), 1 ); |
895 | 912 | } |
896 | 913 | |
897 | 914 | function wfBacktrace() { |