@@ -121,7 +121,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
121121		}
122122
123123		zend_object  * old_exception ;
124- 		const  zend_op  * old_opline_before_exception ;
124+ 		const  zend_op  * old_opline_before_exception   =   NULL ;
125125
126126		if  (destructor -> common .fn_flags  &  (ZEND_ACC_PRIVATE |ZEND_ACC_PROTECTED )) {
127127			if  (EG (current_execute_data )) {
@@ -156,23 +156,26 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
156156			if  (EG (exception ) ==  object ) {
157157				zend_error_noreturn (E_CORE_ERROR , "Attempt to destruct pending exception" );
158158			} else  {
159- 				if  (EG (current_execute_data )
160- 				 &&  EG (current_execute_data )-> func 
161- 				 &&  ZEND_USER_CODE (EG (current_execute_data )-> func -> common .type )) {
162- 					zend_rethrow_exception (EG (current_execute_data ));
159+ 				if  (EG (current_execute_data )) {
160+ 					if  (EG (current_execute_data )-> func 
161+ 					 &&  ZEND_USER_CODE (EG (current_execute_data )-> func -> common .type )) {
162+ 						zend_rethrow_exception (EG (current_execute_data ));
163+ 					}
164+ 					EG (current_execute_data )-> opline  =  EG (opline_before_exception );
165+ 					old_opline_before_exception  =  EG (opline_before_exception );
163166				}
164- 				EG (current_execute_data )-> opline  =  EG (opline_before_exception );
165167				old_exception  =  EG (exception );
166- 				old_opline_before_exception  =  EG (opline_before_exception );
167168				EG (exception ) =  NULL ;
168169			}
169170		}
170171
171172		zend_call_known_instance_method_with_0_params (destructor , object , NULL );
172173
173174		if  (old_exception ) {
174- 			EG (current_execute_data )-> opline  =  EG (exception_op );
175- 			EG (opline_before_exception ) =  old_opline_before_exception ;
175+ 			if  (EG (current_execute_data )) {
176+ 				EG (current_execute_data )-> opline  =  EG (exception_op );
177+ 				EG (opline_before_exception ) =  old_opline_before_exception ;
178+ 			}
176179			if  (EG (exception )) {
177180				zend_exception_set_previous (EG (exception ), old_exception );
178181			} else  {
0 commit comments