Commit 938a3110bf3 for php.net
commit 938a3110bf3a2f978628f1d1ba466308ac012e11
Author: Gina Peter Banyard <girgias@php.net>
Date: Wed Sep 16 15:12:05 2026 +0100
Zend: deprecate is and let as identifiers (#23709)
RFCs:
- https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_let_as_an_identifier
- https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_is_as_an_identifier
diff --git a/Zend/tests/asymmetric_visibility/variation.phpt b/Zend/tests/asymmetric_visibility/variation.phpt
index 03cac375f71..7c49da3739f 100644
--- a/Zend/tests/asymmetric_visibility/variation.phpt
+++ b/Zend/tests/asymmetric_visibility/variation.phpt
@@ -31,7 +31,7 @@ public function im() {
echo 'done';
}
- public function is() {
+ public function is_set() {
echo (int) isset($this->prop);
}
@@ -65,7 +65,7 @@ function im($test) {
echo 'done';
}
-function is($test) {
+function is_set($test) {
echo (int) isset($test->prop);
}
@@ -81,7 +81,7 @@ function us_dim($test) {
foreach ([true, false] as $init) {
foreach ([true, false] as $scope) {
- foreach (['r', 'w', 'rw', 'im', 'is', 'us', 'us_dim'] as $op) {
+ foreach (['r', 'w', 'rw', 'im', 'is_set', 'us', 'us_dim'] as $op) {
$test = new Test();
if ($init) {
$test->init();
@@ -108,27 +108,27 @@ function us_dim($test) {
Init: 1, scope: 1, op: w: done
Init: 1, scope: 1, op: rw: done
Init: 1, scope: 1, op: im: done
-Init: 1, scope: 1, op: is: 1
+Init: 1, scope: 1, op: is_set: 1
Init: 1, scope: 1, op: us: done
Init: 1, scope: 1, op: us_dim: done
Init: 1, scope: 0, op: r: 1
Init: 1, scope: 0, op: w: Cannot modify private(set) property Test::$prop from global scope
Init: 1, scope: 0, op: rw: Cannot modify private(set) property Test::$prop from global scope
Init: 1, scope: 0, op: im: Cannot indirectly modify private(set) property Test::$array from global scope
-Init: 1, scope: 0, op: is: 1
+Init: 1, scope: 0, op: is_set: 1
Init: 1, scope: 0, op: us: Cannot unset private(set) property Test::$prop from global scope
Init: 1, scope: 0, op: us_dim: Cannot indirectly modify private(set) property Test::$array from global scope
Init: 0, scope: 1, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 1, op: w: done
Init: 0, scope: 1, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 1, op: im: done
-Init: 0, scope: 1, op: is: 0
+Init: 0, scope: 1, op: is_set: 0
Init: 0, scope: 1, op: us: done
Init: 0, scope: 1, op: us_dim: done
Init: 0, scope: 0, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 0, op: w: Cannot modify private(set) property Test::$prop from global scope
Init: 0, scope: 0, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 0, op: im: Cannot indirectly modify private(set) property Test::$array from global scope
-Init: 0, scope: 0, op: is: 0
+Init: 0, scope: 0, op: is_set: 0
Init: 0, scope: 0, op: us: Cannot unset private(set) property Test::$prop from global scope
Init: 0, scope: 0, op: us_dim: done
diff --git a/Zend/tests/asymmetric_visibility/variation_nested.phpt b/Zend/tests/asymmetric_visibility/variation_nested.phpt
index c1dc753a944..b38b3a1f30a 100644
--- a/Zend/tests/asymmetric_visibility/variation_nested.phpt
+++ b/Zend/tests/asymmetric_visibility/variation_nested.phpt
@@ -35,7 +35,7 @@ function im($test) {
echo 'done';
}
-function is($test) {
+function is_set($test) {
echo (int) isset($test->prop->prop);
}
@@ -50,7 +50,7 @@ function us_dim($test) {
}
foreach ([true, false] as $init) {
- foreach (['r', 'w', 'rw', 'im', 'is', 'us', 'us_dim'] as $op) {
+ foreach (['r', 'w', 'rw', 'im', 'is_set', 'us', 'us_dim'] as $op) {
$test = new Test();
if ($init) {
$test->init();
@@ -72,13 +72,13 @@ function us_dim($test) {
Init: 1, op: w: done
Init: 1, op: rw: done
Init: 1, op: im: done
-Init: 1, op: is: 1
+Init: 1, op: is_set: 1
Init: 1, op: us: done
Init: 1, op: us_dim: done
Init: 0, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, op: w: Cannot indirectly modify private(set) property Test::$prop from global scope
Init: 0, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, op: im: Cannot indirectly modify private(set) property Test::$prop from global scope
-Init: 0, op: is: 0
+Init: 0, op: is_set: 0
Init: 0, op: us: done
Init: 0, op: us_dim: done
diff --git a/Zend/tests/deprecated_identifiers/is/class_alias.phpt b/Zend/tests/deprecated_identifiers/is/class_alias.phpt
new file mode 100644
index 00000000000..12e9687ec25
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/class_alias.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Using "is" as a class name alias is deprecated
+--FILE--
+<?php
+
+class_alias('stdClass', 'is');
+
+class_alias('stdClass', 'Foo\\is');
+
+?>
+--EXPECTF--
+Deprecated: Using "is" as a class alias is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "is" as a class alias is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/class_as_name.phpt b/Zend/tests/deprecated_identifiers/is/class_as_name.phpt
new file mode 100644
index 00000000000..d6903294267
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/class_as_name.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "is" as a class name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ class is {}
+}
+
+namespace {
+ class is {}
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "is" as a class name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "is" as a class name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/class_as_name_use.phpt b/Zend/tests/deprecated_identifiers/is/class_as_name_use.phpt
new file mode 100644
index 00000000000..e1711c5cddd
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/class_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "is" as a class name in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use stdClass as is;
+}
+
+namespace {
+ use stdClass as is;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "is" as a class name is deprecated in %s on line %d
+
+Deprecated: Using "is" as a class name is deprecated in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/constant_as_name.phpt b/Zend/tests/deprecated_identifiers/is/constant_as_name.phpt
new file mode 100644
index 00000000000..9aa13d15f31
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/constant_as_name.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Using "is" as a constant name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ const is = 5;
+}
+
+namespace {
+ const is = 5;
+
+ define('is', 'x');
+
+ define('foo\\is', 'x');
+}
+
+?>
+--EXPECTF--
+Deprecated: Calling a constant "is" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a constant "is" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a constant "is" is deprecated since 8.6 in %s on line %d
+
+Warning: Constant is already defined, this will be an error in PHP 9 in %s on line %d
+
+Deprecated: Calling a constant "is" is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/constant_as_name_use.phpt b/Zend/tests/deprecated_identifiers/is/constant_as_name_use.phpt
new file mode 100644
index 00000000000..34d4728430d
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/constant_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "is" as a constant in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use const PHP_INT_MAX as is;
+}
+
+namespace {
+ use const PHP_INT_MAX as is;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "is" as a constant name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "is" as a constant name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/function_as_name.phpt b/Zend/tests/deprecated_identifiers/is/function_as_name.phpt
new file mode 100644
index 00000000000..5d57bb7a28f
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/function_as_name.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "is" as a function name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ function is() {}
+}
+
+namespace {
+ function is() {}
+}
+
+?>
+--EXPECTF--
+Deprecated: Calling a function "is" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a function "is" is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/is/function_as_name_use.phpt b/Zend/tests/deprecated_identifiers/is/function_as_name_use.phpt
new file mode 100644
index 00000000000..008260f3fa6
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/is/function_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "is" as a function in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use function strlen as is;
+}
+
+namespace {
+ use function strlen as is;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "is" as a function name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "is" as a function name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/class_alias.phpt b/Zend/tests/deprecated_identifiers/let/class_alias.phpt
new file mode 100644
index 00000000000..087645bfabf
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/class_alias.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Using "let" as a class name alias is deprecated
+--FILE--
+<?php
+
+class_alias('stdClass', 'let');
+
+class_alias('stdClass', 'Foo\\let');
+
+?>
+--EXPECTF--
+Deprecated: Using "let" as a class alias is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "let" as a class alias is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/class_as_name.phpt b/Zend/tests/deprecated_identifiers/let/class_as_name.phpt
new file mode 100644
index 00000000000..ddd96cd1ee1
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/class_as_name.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "let" as a class name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ class let {}
+}
+
+namespace {
+ class let {}
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "let" as a class name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "let" as a class name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/class_as_name_use.phpt b/Zend/tests/deprecated_identifiers/let/class_as_name_use.phpt
new file mode 100644
index 00000000000..040261d4383
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/class_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "let" as a class name in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use stdClass as let;
+}
+
+namespace {
+ use stdClass as let;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "let" as a class name is deprecated in %s on line %d
+
+Deprecated: Using "let" as a class name is deprecated in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/constant_as_name.phpt b/Zend/tests/deprecated_identifiers/let/constant_as_name.phpt
new file mode 100644
index 00000000000..a276ffecf63
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/constant_as_name.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Using "let" as a constant name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ const let = 5;
+}
+
+namespace {
+ const let = 5;
+
+ define('let', 'x');
+
+ define('foo\\let', 'x');
+}
+
+?>
+--EXPECTF--
+Deprecated: Calling a constant "let" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a constant "let" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a constant "let" is deprecated since 8.6 in %s on line %d
+
+Warning: Constant let already defined, this will be an error in PHP 9 in %s on line %d
+
+Deprecated: Calling a constant "let" is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/constant_as_name_use.phpt b/Zend/tests/deprecated_identifiers/let/constant_as_name_use.phpt
new file mode 100644
index 00000000000..fab6fb0db7d
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/constant_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "let" as a constant in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use const PHP_INT_MAX as let;
+}
+
+namespace {
+ use const PHP_INT_MAX as let;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "let" as a constant name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "let" as a constant name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/function_as_name.phpt b/Zend/tests/deprecated_identifiers/let/function_as_name.phpt
new file mode 100644
index 00000000000..c37f11007fa
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/function_as_name.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "let" as a function name is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ function let() {}
+}
+
+namespace {
+ function let() {}
+}
+
+?>
+--EXPECTF--
+Deprecated: Calling a function "let" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a function "let" is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/let/function_as_name_use.phpt b/Zend/tests/deprecated_identifiers/let/function_as_name_use.phpt
new file mode 100644
index 00000000000..7dc501ea703
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/let/function_as_name_use.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "let" as a function in use statements is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use function strlen as let;
+}
+
+namespace {
+ use function strlen as let;
+}
+
+?>
+--EXPECTF--
+Deprecated: Using "let" as a function name is deprecated since 8.6 in %s on line %d
+
+Deprecated: Using "let" as a function name is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/readonly/function_as_name.phpt b/Zend/tests/deprecated_identifiers/readonly/function_as_name.phpt
new file mode 100644
index 00000000000..9c15743e5f0
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/readonly/function_as_name.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using "readonly" as a function name readonly is deprecated
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ function readonly() {}
+}
+
+namespace {
+ function readonly() {}
+}
+
+?>
+--EXPECTF--
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
+
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
diff --git a/Zend/tests/deprecated_identifiers/readonly/function_as_name_use.phpt b/Zend/tests/deprecated_identifiers/readonly/function_as_name_use.phpt
new file mode 100644
index 00000000000..b8f7a6dd270
--- /dev/null
+++ b/Zend/tests/deprecated_identifiers/readonly/function_as_name_use.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Using "readonly" as a function in use statements was never supported
+--FILE--
+<?php
+
+namespace Foo\Bar {
+ use function strlen as readonly;
+}
+
+namespace {
+ use function strlen as readonly;
+}
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected token "readonly", expecting identifier in %s on line %d
diff --git a/Zend/tests/functions/readonly_as_fn_name_is_deprecated.phpt b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated.phpt
similarity index 58%
rename from Zend/tests/functions/readonly_as_fn_name_is_deprecated.phpt
rename to Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated.phpt
index 2ac975dcf65..4a53a98b104 100644
--- a/Zend/tests/functions/readonly_as_fn_name_is_deprecated.phpt
+++ b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated.phpt
@@ -8,5 +8,5 @@ function readonly() {}
?>
DONE
--EXPECTF--
-Deprecated: Calling a function “readonly” is deprecated in %s on line %d
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
DONE
diff --git a/Zend/tests/functions/readonly_as_fn_name_is_deprecated_namespaced.phpt b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_namespaced.phpt
similarity index 61%
rename from Zend/tests/functions/readonly_as_fn_name_is_deprecated_namespaced.phpt
rename to Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_namespaced.phpt
index f4b39d6c3e5..b55f8478652 100644
--- a/Zend/tests/functions/readonly_as_fn_name_is_deprecated_namespaced.phpt
+++ b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_namespaced.phpt
@@ -10,5 +10,5 @@ function readonly() {}
?>
DONE
--EXPECTF--
-Deprecated: Calling a function “readonly” is deprecated in %s on line %d
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
DONE
diff --git a/Zend/tests/functions/readonly_as_fn_name_is_deprecated_throw_handler.phpt b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_throw_handler.phpt
similarity index 79%
rename from Zend/tests/functions/readonly_as_fn_name_is_deprecated_throw_handler.phpt
rename to Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_throw_handler.phpt
index 428bd339d11..4681ccd0618 100644
--- a/Zend/tests/functions/readonly_as_fn_name_is_deprecated_throw_handler.phpt
+++ b/Zend/tests/deprecated_identifiers/readonly/readonly_as_fn_name_is_deprecated_throw_handler.phpt
@@ -13,5 +13,5 @@ function readonly() {}
?>
DONE
--EXPECTF--
-Deprecated: Calling a function “readonly” is deprecated in %s on line %d
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
DONE
diff --git a/Zend/tests/grammar/readonly_function.phpt b/Zend/tests/grammar/readonly_function.phpt
index c1592aa1fe8..30dc3d41eb3 100644
--- a/Zend/tests/grammar/readonly_function.phpt
+++ b/Zend/tests/grammar/readonly_function.phpt
@@ -33,7 +33,7 @@ function readonly() {
?>
--EXPECTF--
-Deprecated: Calling a function “readonly” is deprecated in %s on line %d
+Deprecated: Calling a function "readonly" is deprecated since 8.6 in %s on line %d
Hi!
Const hi!
Static hi!
diff --git a/Zend/tests/readonly_props/variation.phpt b/Zend/tests/readonly_props/variation.phpt
index 420eec8705d..32291d7a090 100644
--- a/Zend/tests/readonly_props/variation.phpt
+++ b/Zend/tests/readonly_props/variation.phpt
@@ -31,7 +31,7 @@ public function im() {
echo 'done';
}
- public function is() {
+ public function is_set() {
echo (int) isset($this->prop);
}
@@ -65,7 +65,7 @@ function im($test) {
echo 'done';
}
-function is($test) {
+function is_set($test) {
echo (int) isset($test->prop);
}
@@ -81,7 +81,7 @@ function us_dim($test) {
foreach ([true, false] as $init) {
foreach ([true, false] as $scope) {
- foreach (['r', 'w', 'rw', 'im', 'is', 'us', 'us_dim'] as $op) {
+ foreach (['r', 'w', 'rw', 'im', 'is_set', 'us', 'us_dim'] as $op) {
$test = new Test();
if ($init) {
$test->init();
@@ -108,27 +108,27 @@ function us_dim($test) {
Init: 1, scope: 1, op: w: Cannot modify readonly property Test::$prop
Init: 1, scope: 1, op: rw: Cannot modify readonly property Test::$prop
Init: 1, scope: 1, op: im: Cannot indirectly modify readonly property Test::$prop
-Init: 1, scope: 1, op: is: 1
+Init: 1, scope: 1, op: is_set: 1
Init: 1, scope: 1, op: us: Cannot unset readonly property Test::$prop
Init: 1, scope: 1, op: us_dim: Cannot indirectly modify readonly property Test::$array
Init: 1, scope: 0, op: r: 1
Init: 1, scope: 0, op: w: Cannot modify readonly property Test::$prop
Init: 1, scope: 0, op: rw: Cannot modify readonly property Test::$prop
Init: 1, scope: 0, op: im: Cannot indirectly modify readonly property Test::$prop
-Init: 1, scope: 0, op: is: 1
+Init: 1, scope: 0, op: is_set: 1
Init: 1, scope: 0, op: us: Cannot unset readonly property Test::$prop
Init: 1, scope: 0, op: us_dim: Cannot indirectly modify readonly property Test::$array
Init: 0, scope: 1, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 1, op: w: done
Init: 0, scope: 1, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 1, op: im: Cannot indirectly modify readonly property Test::$prop
-Init: 0, scope: 1, op: is: 0
+Init: 0, scope: 1, op: is_set: 0
Init: 0, scope: 1, op: us: done
Init: 0, scope: 1, op: us_dim: done
Init: 0, scope: 0, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 0, op: w: Cannot modify protected(set) readonly property Test::$prop from global scope
Init: 0, scope: 0, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, scope: 0, op: im: Cannot indirectly modify readonly property Test::$prop
-Init: 0, scope: 0, op: is: 0
+Init: 0, scope: 0, op: is_set: 0
Init: 0, scope: 0, op: us: Cannot unset protected(set) readonly property Test::$prop from global scope
Init: 0, scope: 0, op: us_dim: done
diff --git a/Zend/tests/readonly_props/variation_nested.phpt b/Zend/tests/readonly_props/variation_nested.phpt
index 31608afcc2c..241bfb7c892 100644
--- a/Zend/tests/readonly_props/variation_nested.phpt
+++ b/Zend/tests/readonly_props/variation_nested.phpt
@@ -35,7 +35,7 @@ function im($test) {
echo 'done';
}
-function is($test) {
+function is_set($test) {
echo (int) isset($test->prop->prop);
}
@@ -50,7 +50,7 @@ function us_dim($test) {
}
foreach ([true, false] as $init) {
- foreach (['r', 'w', 'rw', 'im', 'is', 'us', 'us_dim'] as $op) {
+ foreach (['r', 'w', 'rw', 'im', 'is_set', 'us', 'us_dim'] as $op) {
$test = new Test();
if ($init) {
$test->init();
@@ -72,13 +72,13 @@ function us_dim($test) {
Init: 1, op: w: done
Init: 1, op: rw: done
Init: 1, op: im: done
-Init: 1, op: is: 1
+Init: 1, op: is_set: 1
Init: 1, op: us: done
Init: 1, op: us_dim: done
Init: 0, op: r: Typed property Test::$prop must not be accessed before initialization
Init: 0, op: w: Cannot indirectly modify readonly property Test::$prop
Init: 0, op: rw: Typed property Test::$prop must not be accessed before initialization
Init: 0, op: im: Cannot indirectly modify readonly property Test::$prop
-Init: 0, op: is: 0
+Init: 0, op: is_set: 0
Init: 0, op: us: done
Init: 0, op: us_dim: done
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5aa1b07f304..7151d0764fa 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -254,6 +254,10 @@ void zend_assert_valid_class_name(const zend_string *name, const char *type) /*
}
if (zend_string_equals_literal(name, "_") || zend_string_ends_with_literal(name, "\\_")) {
zend_error(E_DEPRECATED, "Using \"_\" as %s is deprecated since 8.4", type);
+ } else if (zend_string_equals_literal_ci(name, "let") || zend_string_ends_with_literal(name, "\\let")) {
+ zend_error(E_DEPRECATED, "Using \"let\" as %s is deprecated since 8.6", type);
+ } else if (zend_string_equals_literal_ci(name, "is") || zend_string_ends_with_literal(name, "\\is")) {
+ zend_error(E_DEPRECATED, "Using \"is\" as %s is deprecated since 8.6", type);
}
}
/* }}} */
@@ -8952,8 +8956,12 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array,
"__autoload() is no longer supported, use spl_autoload_register() instead");
}
- if (zend_string_equals_literal_ci(unqualified_name, "readonly")) {
- zend_error(E_DEPRECATED, "Calling a function “readonly” is deprecated");
+ if (
+ zend_string_equals_literal_ci(unqualified_name, "readonly")
+ || zend_string_equals_literal_ci(unqualified_name, "let")
+ || zend_string_equals_literal_ci(unqualified_name, "is")
+ ) {
+ zend_error(E_DEPRECATED, "Calling a function \"%pS\" is deprecated since 8.6", unqualified_name);
}
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
@@ -10213,15 +10221,23 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */
"is a special class name", ZSTR_VAL(old_name), ZSTR_VAL(new_name), ZSTR_VAL(new_name));
}
- if (zend_string_equals(new_name, ZSTR_CHAR('_'))) {
+ if (
+ zend_string_equals(new_name, ZSTR_CHAR('_'))
+ || zend_string_equals_literal_ci(new_name, "let")
+ || zend_string_equals_literal_ci(new_name, "is")
+ ) {
switch (type) {
case ZEND_SYMBOL_CLASS:
- zend_error(E_DEPRECATED, "Using \"_\" as a class name is deprecated");
+ zend_error(E_DEPRECATED, "Using \"%pS\" as a class name is deprecated", new_name);
break;
case ZEND_SYMBOL_CONST:
- zend_error(E_DEPRECATED, "Using \"_\" as a constant name is deprecated since 8.6");
+ zend_error(E_DEPRECATED, "Using \"%pS\" as a constant name is deprecated since 8.6", new_name);
break;
case ZEND_SYMBOL_FUNCTION:
+ if (zend_string_equals(new_name, ZSTR_CHAR('_'))) {
+ break;
+ }
+ zend_error(E_DEPRECATED, "Using \"%pS\" as a function name is deprecated since 8.6", new_name);
break;
default: ZEND_UNREACHABLE();
}
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index c8a2ae62d75..6f50c59641c 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -538,12 +538,14 @@ ZEND_API zend_constant *zend_register_constant(zend_constant *c)
c->attributes = NULL;
- if (
- zend_string_equals(name, ZSTR_CHAR('_'))
- || (slash && zend_string_ends_with_literal(name, "\\_"))
- ) {
+ if (zend_string_equals(name, ZSTR_CHAR('_')) || zend_string_ends_with_literal(name, "\\_")) {
zend_error(E_DEPRECATED, "Calling a constant \"_\" is deprecated since 8.6");
+ } else if (zend_string_equals_literal_ci(name, "let") || zend_string_ends_with_literal(name, "\\let")) {
+ zend_error(E_DEPRECATED, "Calling a constant \"let\" is deprecated since 8.6");
+ } else if (zend_string_equals_literal_ci(name, "is") || zend_string_ends_with_literal(name, "\\is")) {
+ zend_error(E_DEPRECATED, "Calling a constant \"is\" is deprecated since 8.6");
}
+
/* Check if the user is trying to define any special constant */
if (zend_string_equals_literal(name, "__COMPILER_HALT_OFFSET__")
|| (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)))