Ensure that $call['args'] is set before using it
authorKevin Israel <pleasestand@live.com>
Sun, 13 Oct 2013 13:49:03 +0000 (09:49 -0400)
committerKevin Israel <pleasestand@live.com>
Sun, 13 Oct 2013 14:31:06 +0000 (10:31 -0400)
Fixes PHP Notice:  Undefined index: args in /home/ki/Projects/mediawiki/
core/includes/Exception.php on line 755 when running code from
maintenance/eval.php .

Change-Id: Ic4a806232aadae0a60f5bc06de1604d9c5996e6f

includes/Exception.php

index 6724c4a..b97697d 100644 (file)
@@ -752,13 +752,15 @@ class MWExceptionHandler {
                                $finalExceptionText .= $call['function'];
                        }
                        $args = array();
-                       foreach ( $call['args'] as $arg ) {
-                               if ( is_object( $arg ) ) {
-                                       $args[] = 'Object(' . get_class( $arg ) . ')';
-                               } elseif( is_array( $arg ) ) {
-                                       $args[] = 'Array';
-                               } else {
-                                       $args[] = var_export( $arg, true );
+                       if ( isset( $call['args'] ) ) {
+                               foreach ( $call['args'] as $arg ) {
+                                       if ( is_object( $arg ) ) {
+                                               $args[] = 'Object(' . get_class( $arg ) . ')';
+                                       } elseif( is_array( $arg ) ) {
+                                               $args[] = 'Array';
+                                       } else {
+                                               $args[] = var_export( $arg, true );
+                                       }
                                }
                        }
                        $finalExceptionText .=  '(' . implode( ', ', $args ) . ")\n";