mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Deprecate using "_" as a class name (#15360)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
This commit is contained in:
parent
c818d944cf
commit
0a23b0678d
4 changed files with 24 additions and 0 deletions
1
NEWS
1
NEWS
|
@ -11,6 +11,7 @@ PHP NEWS
|
||||||
. Fixed bug GH-15181 (Disabled output handler is flushed again). (cmb)
|
. Fixed bug GH-15181 (Disabled output handler is flushed again). (cmb)
|
||||||
. Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias)
|
. Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias)
|
||||||
. Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos)
|
. Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos)
|
||||||
|
. Using "_" as a class name is now deprecated. (Girgias)
|
||||||
|
|
||||||
- Curl:
|
- Curl:
|
||||||
. Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY
|
. Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY
|
||||||
|
|
|
@ -410,6 +410,8 @@ PHP 8.4 UPGRADE NOTES
|
||||||
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
|
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
|
||||||
. Passing E_USER_ERROR to trigger_error() is now deprecated.
|
. Passing E_USER_ERROR to trigger_error() is now deprecated.
|
||||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
|
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
|
||||||
|
. Using "_" as a class name is now deprecated.
|
||||||
|
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
|
||||||
|
|
||||||
- Curl:
|
- Curl:
|
||||||
. The CURLOPT_BINARYTRANSFER constant is deprecated.
|
. The CURLOPT_BINARYTRANSFER constant is deprecated.
|
||||||
|
|
18
Zend/tests/class_underscore_as_name.phpt
Normal file
18
Zend/tests/class_underscore_as_name.phpt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
--TEST--
|
||||||
|
Using "_" as a class name is deprecated
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Foo\Bar {
|
||||||
|
class _ {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class _ {}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Deprecated: Using "_" as a class name is deprecated since 8.4 in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Using "_" as a class name is deprecated since 8.4 in %s on line %d
|
|
@ -243,6 +243,9 @@ void zend_assert_valid_class_name(const zend_string *name) /* {{{ */
|
||||||
zend_error_noreturn(E_COMPILE_ERROR,
|
zend_error_noreturn(E_COMPILE_ERROR,
|
||||||
"Cannot use '%s' as class name as it is reserved", ZSTR_VAL(name));
|
"Cannot use '%s' as class name as it is reserved", ZSTR_VAL(name));
|
||||||
}
|
}
|
||||||
|
if (zend_string_equals_literal(name, "_")) {
|
||||||
|
zend_error(E_DEPRECATED, "Using \"_\" as a class name is deprecated since 8.4");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue