@@ -5969,7 +5969,15 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
59695969 }
59705970
59715971 constructor = Z_OBJ_HT_P (result )-> get_constructor (Z_OBJ_P (result ));
5972- if (constructor == NULL ) {
5972+ if (UNEXPECTED (constructor == NULL )) {
5973+ /* No constructor implies that an internal get_constructor was overwritten and threw an exception. */
5974+ if (UNEXPECTED (!EG (exception ))) {
5975+ zend_throw_error (NULL , "No constructor for %s class" , ZSTR_VAL (ce -> name ));
5976+ }
5977+ HANDLE_EXCEPTION ();
5978+ }
5979+ /* Pass function is special */
5980+ else if (zend_is_pass_function (constructor )) {
59735981 /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
59745982 * opcode is DO_FCALL in case EXT instructions are used. */
59755983 if (EXPECTED (opline -> extended_value == 0 && (opline + 1 )-> opcode == ZEND_DO_FCALL )) {
@@ -5982,7 +5990,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
59825990
59835991 /* Perform a dummy function call */
59845992 call = zend_vm_stack_push_call_frame (
5985- ZEND_CALL_FUNCTION , ( zend_function * ) & zend_pass_function ,
5993+ ZEND_CALL_FUNCTION , constructor ,
59865994 opline -> extended_value , NULL );
59875995 } else {
59885996 if (EXPECTED (constructor -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& constructor -> op_array ))) {
0 commit comments