23
23
* php zend_vm_gen.php
24
24
*/
25
25
26
+ #include "zend.h"
27
+ #include "zend_portability.h"
28
+
26
29
ZEND_VM_HELPER (zend_add_helper , ANY , ANY , zval * op_1 , zval * op_2 )
27
30
{
28
31
USE_OPLINE
@@ -5969,7 +5972,15 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
5969
5972
}
5970
5973
5971
5974
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 ) {
5973
5984
/* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
5974
5985
* opcode is DO_FCALL in case EXT instructions are used. */
5975
5986
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
5982
5993
5983
5994
/* Perform a dummy function call */
5984
5995
call = zend_vm_stack_push_call_frame (
5985
- ZEND_CALL_FUNCTION , ( zend_function * ) & zend_pass_function ,
5996
+ ZEND_CALL_FUNCTION , constructor ,
5986
5997
opline -> extended_value , NULL );
5987
5998
} else {
5988
5999
if (EXPECTED (constructor -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& constructor -> op_array ))) {
0 commit comments