com php-src: Revert "Improved fix for Fully qualified (leading backslash) type names must fail": NEWS Zend/tests/typehints/fully_qualif ied_array.phpt
Zend/tests/typehints/fully_qualified_s calar.phpt Zend/zend_compile.c Zend/zend_language _parser.y
| From: | Xinchen Hui | Date: | Wed, 25 Nov 2015 11:06:42 +0000 |
| Subject: | com php-src: Revert "Improved fix for Fully qualified (leading backslash) type names must fail": NEWS Zend/tests/typehints/fully_qualif ied_array.phpt Zend/tests/typehints/fully_qualified_s calar.phpt Zend/zend_compile.c Zend/zend_language _parser.y |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90023@lists.php.net to get a copy of this message | ||
Commit: 05738eb71a05190a7a9df0f5fd1d1c4b7dd49d82
Author: Xinchen Hui <laruence@gmail.com> Wed, 25 Nov 2015 19:06:42 +0800
Parents: 0134de7cff377ecda5cc2338d3fbd42b77d0ec16
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=05738eb71a05190a7a9df0f5fd1d1c4b7dd49d82
Log:
Revert "Improved fix for Fully qualified (leading backslash) type names must fail"
This reverts commit 00865ae22f2c5fdee9e500ce79d442467e0a0899.
Changed paths:
M NEWS
D Zend/tests/typehints/fully_qualified_array.phpt
M Zend/tests/typehints/fully_qualified_scalar.phpt
M Zend/zend_compile.c
M Zend/zend_language_parser.y
Diff:
diff --git a/NEWS b/NEWS
index 27a4e5c..ea2e239 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ PHP NEWS
. 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, Laruence)
+ to not be accepted as type name. (Bob)
. Fixed bug #70904 (yield from incorrectly marks valid generator as finished).
(Bob)
diff --git a/Zend/tests/typehints/fully_qualified_array.phpt
b/Zend/tests/typehints/fully_qualified_array.phpt
deleted file mode 100644
index b1d32e7..0000000
--- a/Zend/tests/typehints/fully_qualified_array.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---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
diff --git a/Zend/tests/typehints/fully_qualified_scalar.phpt
b/Zend/tests/typehints/fully_qualified_scalar.phpt
index bdc3fbf..fcc4360 100644
--- a/Zend/tests/typehints/fully_qualified_scalar.phpt
+++ b/Zend/tests/typehints/fully_qualified_scalar.phpt
@@ -10,4 +10,4 @@ foo(1);
?>
--EXPECTF--
-Fatal error: Cannot use the builtin type 'int' as fully qualified with a leading
backslash in %s on line %d
+Fatal error: Cannot use the scalar type 'int' as fully qualified with a leading backslash
in %s on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 73f21a8..201afd0 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4384,7 +4384,7 @@ static void zend_compile_typename(zend_ast *ast, zend_arg_info *arg_info) /*
{{{
if (type != 0) {
if (ast->attr == ZEND_NAME_FQ) {
- 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)));
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the scalar type '%s' as fully
qualified with a leading backslash", ZSTR_VAL(class_name));
}
arg_info->type_hint = type;
} else {
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index ed7af7e..3fc6494 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -643,12 +643,6 @@ optional_type:
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; }
;