xref: /PHP-5.3/Zend/tests/bug42802.phpt (revision 610c7fbe)
1--TEST--
2Bug #42802 (Namespace not supported in typehints)
3--FILE--
4<?php
5namespace foo;
6
7class bar {
8}
9
10function test1(bar $bar) {
11	echo "ok\n";
12}
13
14function test2(\foo\bar $bar) {
15        echo "ok\n";
16}
17function test3(\foo\bar $bar) {
18        echo "ok\n";
19}
20function test4(\Exception $e) {
21	echo "ok\n";
22}
23function test5(\bar $bar) {
24        echo "bug\n";
25}
26
27$x = new bar();
28$y = new \Exception();
29test1($x);
30test2($x);
31test3($x);
32test4($y);
33test5($x);
34--EXPECTF--
35ok
36ok
37ok
38ok
39
40Catchable fatal error: Argument 1 passed to foo\test5() must be an instance of bar, instance of foo\bar given, called in %sbug42802.php on line %d and defined in %sbug42802.php on line %d
41