@@ -4453,7 +4453,6 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, JMP_ADDR, LAST_CATCH|CACHE_SLOT)
44534453 USE_OPLINE
44544454 zend_class_entry * ce , * catch_ce ;
44554455 zend_object * exception ;
4456- zval * ex ;
44574456
44584457 SAVE_OPLINE ();
44594458 /* Check whether an exception has been thrown, if not, jump over code */
@@ -4486,17 +4485,18 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, JMP_ADDR, LAST_CATCH|CACHE_SLOT)
44864485 }
44874486
44884487 exception = EG (exception );
4489- ex = EX_VAR ( opline -> result . var ) ;
4490- {
4488+ EG ( exception ) = NULL ;
4489+ if ( RETURN_VALUE_USED ( opline )) {
44914490 /* Always perform a strict assignment. There is a reasonable expectation that if you
44924491 * write "catch (Exception $e)" then $e will actually be instanceof Exception. As such,
44934492 * we should not permit coercion to string here. */
44944493 zval tmp ;
44954494 ZVAL_OBJ (& tmp , exception );
4496- EG ( exception ) = NULL ;
4497- zend_assign_to_variable ( ex , & tmp , IS_TMP_VAR , /* strict */ 1 );
4498- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( );
4495+ zend_assign_to_variable ( EX_VAR ( opline -> result . var ), & tmp , IS_TMP_VAR , /* strict */ 1 ) ;
4496+ } else {
4497+ OBJ_RELEASE ( exception );
44994498 }
4499+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ();
45004500}
45014501
45024502ZEND_VM_HOT_HANDLER (65 , ZEND_SEND_VAL , CONST |TMPVAR , NUM )
0 commit comments