@@ -555,27 +555,30 @@ static inline void phpdbg_handle_exception(void) /* }}} */
555
555
{
556
556
zend_fcall_info fci ;
557
557
zval trace ;
558
+ zend_object * ex = EG (exception );
558
559
559
560
/* get filename and linenumber before unsetting exception */
560
561
const char * filename = zend_get_executed_filename ();
561
562
uint32_t lineno = zend_get_executed_lineno ();
562
563
564
+ EG (exception ) = NULL ;
565
+
563
566
/* call __toString */
564
567
ZVAL_STRINGL (& fci .function_name , "__tostring" , sizeof ("__tostring" ) - 1 );
565
568
fci .size = sizeof (fci );
566
- fci .function_table = & EG ( exception ) -> ce -> function_table ;
569
+ fci .function_table = & ex -> ce -> function_table ;
567
570
fci .symbol_table = NULL ;
568
- fci .object = EG ( exception ) ;
571
+ fci .object = ex ;
569
572
fci .retval = & trace ;
570
573
fci .param_count = 0 ;
571
574
fci .params = NULL ;
572
575
fci .no_separation = 1 ;
573
576
if (zend_call_function (& fci , NULL ) == SUCCESS ) {
574
- phpdbg_writeln ("exception" , "name=\"%s\" trace=\"%.*s\"" , "Uncaught %s!\n%.*s" , EG ( exception ) -> ce -> name -> val , Z_STRLEN (trace ), Z_STRVAL (trace ));
577
+ phpdbg_writeln ("exception" , "name=\"%s\" trace=\"%.*s\"" , "Uncaught %s!\n%.*s" , ex -> ce -> name -> val , Z_STRLEN (trace ), Z_STRVAL (trace ));
575
578
576
579
zval_ptr_dtor (& trace );
577
580
} else {
578
- phpdbg_error ("exception" , "name=\"%s\"" , "Uncaught %s!" , EG ( exception ) -> ce -> name -> val );
581
+ phpdbg_error ("exception" , "name=\"%s\"" , "Uncaught %s!" , ex -> ce -> name -> val );
579
582
}
580
583
581
584
/* output useful information about address */
@@ -587,8 +590,7 @@ static inline void phpdbg_handle_exception(void) /* }}} */
587
590
OBJ_RELEASE (EG (prev_exception ));
588
591
EG (prev_exception ) = 0 ;
589
592
}
590
- OBJ_RELEASE (EG (exception ));
591
- EG (exception ) = NULL ;
593
+ OBJ_RELEASE (ex );
592
594
EG (opline_before_exception ) = NULL ;
593
595
} /* }}} */
594
596
0 commit comments