6 changed files with 67 additions and 19 deletions
-
45Zend/tests/bug42802.phpt
-
3Zend/zend_compile.c
-
12Zend/zend_execute.c
-
6Zend/zend_language_parser.y
-
10Zend/zend_vm_def.h
-
10Zend/zend_vm_execute.h
@ -0,0 +1,45 @@ |
|||
--TEST-- |
|||
Bug #42802 (Namespace not supported in typehints) |
|||
--FILE-- |
|||
<?php |
|||
namespace foo; |
|||
|
|||
class bar { |
|||
} |
|||
|
|||
function test1(bar $bar) { |
|||
echo "ok\n"; |
|||
} |
|||
|
|||
function test2(foo::bar $bar) { |
|||
echo "ok\n"; |
|||
} |
|||
function test3(::foo::bar $bar) { |
|||
echo "ok\n"; |
|||
} |
|||
function test4(::Exception $e) { |
|||
echo "ok\n"; |
|||
} |
|||
function test5(Exception $e) { |
|||
echo "ok\n"; |
|||
} |
|||
function test6(::bar $bar) { |
|||
echo "bug\n"; |
|||
} |
|||
|
|||
$x = new bar(); |
|||
$y = new Exception(); |
|||
test1($x); |
|||
test2($x); |
|||
test3($x); |
|||
test4($y); |
|||
test5($y); |
|||
test6($x); |
|||
--EXPECTF-- |
|||
ok |
|||
ok |
|||
ok |
|||
ok |
|||
ok |
|||
|
|||
Catchable fatal error: Argument 1 passed to foo::test6() must be an instance of bar, instance of foo::bar given, called in %sbug42802.php on line 23 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue