diff --git a/Zend/tests/gh11152.phpt b/Zend/tests/gh11152.phpt new file mode 100644 index 0000000000000..19f0a94a3430f --- /dev/null +++ b/Zend/tests/gh11152.phpt @@ -0,0 +1,22 @@ +--TEST-- +GH-11152: Allow aliasing namespaces ending in reserved class names +--FILE-- + +--EXPECT-- +string(10) "N\String\C" diff --git a/Zend/tests/use_statement/aliasing_builtin_types.phpt b/Zend/tests/use_statement/aliasing_builtin_types.phpt deleted file mode 100644 index 681a77c24b28a..0000000000000 --- a/Zend/tests/use_statement/aliasing_builtin_types.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Aliasing built-in types ---FILE-- - ---EXPECTF-- -Fatal error: Cannot alias 'bool' as it is a built-in type in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9036fc8ca66db..53fb5c7f4f7f8 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8124,12 +8124,6 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */ zend_string *old_name = zend_ast_get_str(old_name_ast); zend_string *new_name, *lookup_name; - /* Check that we are not attempting to alias a built-in type */ - if (type == ZEND_SYMBOL_CLASS && zend_is_reserved_class_name(old_name)) { - zend_error_noreturn(E_COMPILE_ERROR, - "Cannot alias '%s' as it is a built-in type", ZSTR_VAL(old_name)); - } - if (new_name_ast) { new_name = zend_string_copy(zend_ast_get_str(new_name_ast)); } else {