. Fixed bug #61751 (SAPI build problem on AIX: Undefined symbol:
php_register_internal_extensions). (Lior Kaplan)
. Fixed \int (or generally every scalar type name with leading backslash)
- to not be accepted as type name. (Bob)
+ to not be accepted as type name. (Bob, Laruence)
. Fixed bug #70904 (yield from incorrectly marks valid generator as finished).
(Bob)
--- /dev/null
+--TEST--
+Fully qualified (leading backslash) type names must fail
+--FILE--
+<?php
+
+function foo(\array $foo) {
+ var_dump($foo);
+}
+foo(1);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use the builtin type 'array' as fully qualified with a leading backslash in %s on line %d
?>
--EXPECTF--
-Fatal error: Cannot use the scalar type 'int' as fully qualified with a leading backslash in %s on line %d
+Fatal error: Cannot use the builtin type 'int' as fully qualified with a leading backslash in %s on line %d
if (type != 0) {
if (ast->attr == ZEND_NAME_FQ) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the scalar type '%s' as fully qualified with a leading backslash", ZSTR_VAL(class_name));
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the builtin type '%s' as fully qualified with a leading backslash", ZSTR_VAL(zend_string_tolower(class_name)));
}
arg_info->type_hint = type;
} else {
type:
T_ARRAY { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
| T_CALLABLE { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
+ | T_NS_SEPARATOR T_ARRAY
+ { $$ = NULL; zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use the builtin type 'array' as fully qualified with a leading backslash"); }
+ | T_NS_SEPARATOR T_CALLABLE
+ { $$ = NULL; zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use the builtin type 'callable' as fully qualified with a leading backslash"); }
| name { $$ = $1; }
;