summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_def.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-09-21 15:05:03 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-09-21 15:06:04 +0200
commit213b6667817b887e29f7fdf3a046c37c4462f756 (patch)
tree1c6d23c87354eec9157c64ecba7144b10451b012 /Zend/zend_vm_def.h
parentd085a7439f577eb0690a4e896f39f65dc87cdfe3 (diff)
downloadphp-git-213b6667817b887e29f7fdf3a046c37c4462f756.tar.gz
Synchronize GET_CLASS/GET_CALLED_CLASS opcodes with functions
These error conditions throw in the function implementations, make the opcodes match.
Diffstat (limited to 'Zend/zend_vm_def.h')
-rw-r--r--Zend/zend_vm_def.h17
1 files changed, 8 insertions, 9 deletions
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();
}