Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PHP NEWS
. Fixed bug GH-15181 (Disabled output handler is flushed again). (cmb)
. Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias)
. Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos)
. Using "_" as a class name is now deprecated. (Girgias)

- Date:
. Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and SUNFUNCS_RET_DOUBLE
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ PHP 8.4 UPGRADE NOTES
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
. 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
. 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:
. The CURLOPT_BINARYTRANSFER constant is deprecated.
Expand Down
18 changes: 18 additions & 0 deletions Zend/tests/class_underscore_as_name.phpt
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ void zend_assert_valid_class_name(const zend_string *name) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR,
"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");
}
}
/* }}} */

Expand Down