@@ -5969,7 +5969,15 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
5969
5969
}
5970
5970
5971
5971
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 )) {
5973
5981
/* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
5974
5982
* opcode is DO_FCALL in case EXT instructions are used. */
5975
5983
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
5982
5990
5983
5991
/* Perform a dummy function call */
5984
5992
call = zend_vm_stack_push_call_frame (
5985
- ZEND_CALL_FUNCTION , ( zend_function * ) & zend_pass_function ,
5993
+ ZEND_CALL_FUNCTION , constructor ,
5986
5994
opline -> extended_value , NULL );
5987
5995
} else {
5988
5996
if (EXPECTED (constructor -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& constructor -> op_array ))) {
0 commit comments