com php-src: Fix handling of qualified nullable parameter types: Zend/tests/typehints/fq_nullable.phpt Zend/zend_compile .c
| From: | Nikita Popov | Date: | Tue, 16 Aug 2016 10:43:17 +0000 |
| Subject: | com php-src: Fix handling of qualified nullable parameter types: Zend/tests/typehints/fq_nullable.phpt Zend/zend_compile .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93798@lists.php.net to get a copy of this message | ||
Commit: 1397f754c8b51ad879c18da85be6b8d1baf77c19
Author: Nikita Popov <nikic@php.net> Tue, 16 Aug 2016 12:41:45 +0200
Parents: 443da77c3506a8fea8f22ae4b459284a0b55b512
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1397f754c8b51ad879c18da85be6b8d1baf77c19
Log:
Fix handling of qualified nullable parameter types
compile_typename() can't deal with TYPE_NULLABLE flags, drop it
beforehand.
Changed paths:
A Zend/tests/typehints/fq_nullable.phpt
M Zend/zend_compile.c
Diff:
diff --git a/Zend/tests/typehints/fq_nullable.phpt b/Zend/tests/typehints/fq_nullable.phpt
new file mode 100644
index 0000000..24ba2ff
--- /dev/null
+++ b/Zend/tests/typehints/fq_nullable.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Fully-qualified nullable parameter type
+--FILE--
+<?php
+
+namespace Foo;
+function test(?\stdClass $param) {}
+test(new \stdClass);
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index fc77c6a..b61a819 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5140,6 +5140,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
arg_info->allow_null = has_null_default || is_explicitly_nullable;
+ type_ast->attr &= ~ZEND_TYPE_NULLABLE;
zend_compile_typename(type_ast, arg_info);
if (arg_info->type_hint == IS_VOID) {