summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-06-23 20:51:49 +0200
committerNikita Popov <nikita.ppv@gmail.com>2018-07-16 19:16:55 +0200
commit3588d8af129489eda3e3fdb9612b09a4da16dcfd (patch)
tree180d52b1c0e33acd97f98cdd4c9d2f839bdd0fa2 /Zend/zend_builtin_functions.c
parenta632ecd22433f8f4b763586407bbc00472feba84 (diff)
downloadphp-git-3588d8af129489eda3e3fdb9612b09a4da16dcfd.tar.gz
Deprecate case-insensitive constants
RFC: https://wiki.php.net/rfc/case_insensitive_constant_deprecation
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 57e5d77380..7b6cebff5e 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -854,7 +854,6 @@ ZEND_FUNCTION(define)
case_sensitive = 0;
}
- /* class constant, check if there is name and make sure class is valid & exists */
if (zend_memnstr(ZSTR_VAL(name), "::", sizeof("::") - 1, ZSTR_VAL(name) + ZSTR_LEN(name))) {
zend_error(E_WARNING, "Class constants cannot be defined or redefined");
RETURN_FALSE;
@@ -905,7 +904,13 @@ repeat:
ZVAL_COPY(&c.value, val);
zval_ptr_dtor(&val_free);
+
register_constant:
+ if (non_cs) {
+ zend_error(E_DEPRECATED,
+ "define(): Declaration of case-insensitive constants is deprecated");
+ }
+
c.flags = case_sensitive; /* non persistent */
c.name = zend_string_copy(name);
c.module_number = PHP_USER_CONSTANT;
@@ -928,7 +933,7 @@ ZEND_FUNCTION(defined)
Z_PARAM_STR(name)
ZEND_PARSE_PARAMETERS_END();
- if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT)) {
+ if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT | ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) {
RETURN_TRUE;
} else {
RETURN_FALSE;