From aad39879f2d2e89de105c4f87d334ee129b4321c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 31 Jan 2019 12:25:51 +0100 Subject: 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. --- Zend/zend_execute_API.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'Zend/zend_execute_API.c') 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; } /* }}} */ -- cgit v1.2.1