Skip to content

Commit 0a23b06

Browse files
authored
1 parent c818d94 commit 0a23b06

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PHP NEWS
1111
. Fixed bug GH-15181 (Disabled output handler is flushed again). (cmb)
1212
. Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias)
1313
. Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos)
14+
. Using "_" as a class name is now deprecated. (Girgias)
1415

1516
- Curl:
1617
. Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ PHP 8.4 UPGRADE NOTES
410410
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
411411
. Passing E_USER_ERROR to trigger_error() is now deprecated.
412412
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
413+
. Using "_" as a class name is now deprecated.
414+
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
413415

414416
- Curl:
415417
. The CURLOPT_BINARYTRANSFER constant is deprecated.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Using "_" as a class name is deprecated
3+
--FILE--
4+
<?php
5+
6+
namespace Foo\Bar {
7+
class _ {}
8+
}
9+
10+
namespace {
11+
class _ {}
12+
}
13+
14+
?>
15+
--EXPECTF--
16+
Deprecated: Using "_" as a class name is deprecated since 8.4 in %s on line %d
17+
18+
Deprecated: Using "_" as a class name is deprecated since 8.4 in %s on line %d

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ void zend_assert_valid_class_name(const zend_string *name) /* {{{ */
243243
zend_error_noreturn(E_COMPILE_ERROR,
244244
"Cannot use '%s' as class name as it is reserved", ZSTR_VAL(name));
245245
}
246+
if (zend_string_equals_literal(name, "_")) {
247+
zend_error(E_DEPRECATED, "Using \"_\" as a class name is deprecated since 8.4");
248+
}
246249
}
247250
/* }}} */
248251

0 commit comments

Comments
 (0)