summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.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_API.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_API.c')
-rw-r--r--Zend/zend_execute_API.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 9215717bcc..5ed80be6ff 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -566,29 +566,10 @@ ZEND_API int zend_use_undefined_constant(zend_string *name, zend_ast_attr attr,
} else if ((colon = (char*)zend_memrchr(ZSTR_VAL(name), ':', ZSTR_LEN(name)))) {
zend_throw_error(NULL, "Undefined class constant '%s'", ZSTR_VAL(name));
return FAILURE;
- } else if ((attr & IS_CONSTANT_UNQUALIFIED) == 0) {
+ } else {
zend_throw_error(NULL, "Undefined constant '%s'", ZSTR_VAL(name));
return FAILURE;
- } else {
- char *actual = ZSTR_VAL(name);
- size_t actual_len = ZSTR_LEN(name);
- char *slash = (char *) zend_memrchr(actual, '\\', actual_len);
-
- if (slash) {
- actual = slash + 1;
- actual_len -= (actual - ZSTR_VAL(name));
- }
-
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual);
- if (EG(exception)) {
- return FAILURE;
- } else {
- zend_string *result_str = zend_string_init(actual, actual_len, 0);
- zval_ptr_dtor_nogc(result);
- ZVAL_NEW_STR(result, result_str);
- }
}
- return SUCCESS;
}
/* }}} */