mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-16665: \array and \callable should not be usable
This list was initially introduced in 53a40386, but never included array or
callable. I suppose this is because int & friends are not actual tokens,
while array and callable are. This means it was never possible to do class
array, which is probably the reason this was overlooked.
Closes GH-16683.
This commit is contained in:
4
NEWS
4
NEWS
@@ -5,6 +5,10 @@ PHP NEWS
|
||||
- COM:
|
||||
. Fix property access of PHP objects wrapped in variant. (cmb)
|
||||
|
||||
- Core:
|
||||
. Fixed bug GH-16665 (\array and \callable should not be usable in
|
||||
class_alias). (nielsdos)
|
||||
|
||||
- Curl:
|
||||
. Added curl_multi_get_handles(). (timwolla)
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ PHP 8.5 UPGRADE NOTES
|
||||
. bzcompress() now throws a ValueError when $work_factor is not between
|
||||
0 and 250.
|
||||
|
||||
- Core:
|
||||
. It is no longer possible to use "array" and "callable" as class alias names
|
||||
in class_alias().
|
||||
|
||||
- LDAP:
|
||||
. ldap_get_option() and ldap_set_option() now throw a ValueError when
|
||||
passing an invalid option.
|
||||
|
||||
8
Zend/tests/gh16665_1.phpt
Normal file
8
Zend/tests/gh16665_1.phpt
Normal file
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
GH-16665 (\array should not be usable)
|
||||
--FILE--
|
||||
<?php
|
||||
class_alias('stdClass', 'array');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use "array" as a class alias as it is reserved in %s on line %d
|
||||
8
Zend/tests/gh16665_2.phpt
Normal file
8
Zend/tests/gh16665_2.phpt
Normal file
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
GH-16665 (\callable should not be usable)
|
||||
--FILE--
|
||||
<?php
|
||||
class_alias('stdClass', 'callable');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use "callable" as a class alias as it is reserved in %s on line %d
|
||||
@@ -214,6 +214,10 @@ static const struct reserved_class_name reserved_class_names[] = {
|
||||
{ZEND_STRL("iterable")},
|
||||
{ZEND_STRL("object")},
|
||||
{ZEND_STRL("mixed")},
|
||||
/* These are not usable as class names because they're proper tokens,
|
||||
* but they are here for class aliases. */
|
||||
{ZEND_STRL("array")},
|
||||
{ZEND_STRL("callable")},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user