summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-31 12:25:51 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-31 13:52:06 +0100
commitaad39879f2d2e89de105c4f87d334ee129b4321c (patch)
treec4a0615c40ddaa3596e1c29e4ccbcdf2ae197c05 /Zend/zend_execute.c
parent3d39479f4d7c86c66aa92fc5d0d97fb660109ee9 (diff)
downloadphp-git-aad39879f2d2e89de105c4f87d334ee129b4321c.tar.gz
Remove bareword fallback for constants
Access to undefined constants will now always result in an Error exception being thrown. This required quite a few test changes, because there were many buggy tests that unintentionally used bareword fallback in combination with error suppression.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 39155e8827..519b295cca 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -4153,7 +4153,7 @@ static zend_always_inline int _zend_quick_get_constant(
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
if (zv) {
c = (zend_constant*)Z_PTR_P(zv);
- } else if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
+ } else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
key++;
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
if (zv) {
@@ -4163,22 +4163,8 @@ static zend_always_inline int _zend_quick_get_constant(
if (!c) {
if (!check_defined_only) {
- if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)));
- if (!actual) {
- ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2)));
- } else {
- actual++;
- ZVAL_STRINGL(EX_VAR(opline->result.var),
- actual, Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)) - (actual - Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))));
- }
- /* non-qualified constant - allow text substitution */
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)",
- Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
- } else {
- zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- }
+ zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return FAILURE;
}