Fix handling of qualified nullable parameter types

compile_typename() can't deal with TYPE_NULLABLE flags, drop it
beforehand.
This commit is contained in:
Nikita Popov 2016-08-16 12:41:45 +02:00
parent 443da77c35
commit 1397f754c8
2 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,13 @@
--TEST--
Fully-qualified nullable parameter type
--FILE--
<?php
namespace Foo;
function test(?\stdClass $param) {}
test(new \stdClass);
?>
===DONE===
--EXPECT--
===DONE===

View file

@ -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; op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
arg_info->allow_null = has_null_default || is_explicitly_nullable; arg_info->allow_null = has_null_default || is_explicitly_nullable;
type_ast->attr &= ~ZEND_TYPE_NULLABLE;
zend_compile_typename(type_ast, arg_info); zend_compile_typename(type_ast, arg_info);
if (arg_info->type_hint == IS_VOID) { if (arg_info->type_hint == IS_VOID) {