From 213b6667817b887e29f7fdf3a046c37c4462f756 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 21 Sep 2020 15:05:03 +0200 Subject: Synchronize GET_CLASS/GET_CALLED_CLASS opcodes with functions These error conditions throw in the function implementations, make the opcodes match. --- Zend/zend_vm_def.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Zend/zend_vm_def.h') diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 510595b7c8..9e10721265 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8940,9 +8940,9 @@ ZEND_VM_COLD_CONST_HANDLER(191, ZEND_GET_CLASS, UNUSED|CONST|TMPVAR|CV, UNUSED) if (OP1_TYPE == IS_UNUSED) { if (UNEXPECTED(!EX(func)->common.scope)) { SAVE_OPLINE(); - zend_error(E_WARNING, "get_class() called without object from outside a class"); - ZVAL_FALSE(EX_VAR(opline->result.var)); - ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); + zend_throw_error(NULL, "get_class() without arguments must be called from within a class"); + ZVAL_UNDEF(EX_VAR(opline->result.var)); + HANDLE_EXCEPTION(); } else { ZVAL_STR_COPY(EX_VAR(opline->result.var), EX(func)->common.scope->name); ZEND_VM_NEXT_OPCODE(); @@ -8981,12 +8981,11 @@ ZEND_VM_HANDLER(192, ZEND_GET_CALLED_CLASS, UNUSED, UNUSED) } else if (Z_CE(EX(This))) { ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_CE(EX(This))->name); } else { - ZVAL_FALSE(EX_VAR(opline->result.var)); - if (UNEXPECTED(!EX(func)->common.scope)) { - SAVE_OPLINE(); - zend_error(E_WARNING, "get_called_class() called from outside a class"); - ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); - } + ZEND_ASSERT(!EX(func)->common.scope); + SAVE_OPLINE(); + zend_throw_error(NULL, "get_called_class() must be called from within a class"); + ZVAL_UNDEF(EX_VAR(opline->result.var)); + HANDLE_EXCEPTION(); } ZEND_VM_NEXT_OPCODE(); } -- cgit v1.2.1