2323 * php zend_vm_gen.php
2424 */
2525
26+ #include "zend.h"
27+ #include "zend_portability.h"
28+
2629ZEND_VM_HELPER (zend_add_helper , ANY , ANY , zval * op_1 , zval * op_2 )
2730{
2831 USE_OPLINE
@@ -5969,7 +5972,15 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
59695972 }
59705973
59715974 constructor = Z_OBJ_HT_P (result )-> get_constructor (Z_OBJ_P (result ));
5972- if (constructor == NULL ) {
5975+ if (UNEXPECTED (constructor == NULL )) {
5976+ /* No constructor implies that an internal get_constructor was overwritten and threw an exception. */
5977+ if (UNEXPECTED (!EG (exception ))) {
5978+ zend_throw_error (NULL , "No constructor for %s class" , ZSTR_VAL (ce -> name ));
5979+ }
5980+ HANDLE_EXCEPTION ();
5981+ }
5982+ /* Pass function is special */
5983+ else if (constructor == (zend_function * ) & zend_pass_function ) {
59735984 /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
59745985 * opcode is DO_FCALL in case EXT instructions are used. */
59755986 if (EXPECTED (opline -> extended_value == 0 && (opline + 1 )-> opcode == ZEND_DO_FCALL )) {
@@ -5982,7 +5993,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
59825993
59835994 /* Perform a dummy function call */
59845995 call = zend_vm_stack_push_call_frame (
5985- ZEND_CALL_FUNCTION , ( zend_function * ) & zend_pass_function ,
5996+ ZEND_CALL_FUNCTION , constructor ,
59865997 opline -> extended_value , NULL );
59875998 } else {
59885999 if (EXPECTED (constructor -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& constructor -> op_array ))) {
0 commit comments