summaryrefslogtreecommitdiff
path: root/Zend/tests/bug42802.phpt
blob: 2aa7061f35a08b96c32cbdafb098e91cbe9d0129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--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(\bar $bar) {
        echo "bug\n";
}

$x = new bar();
$y = new \Exception();
test1($x);
test2($x);
test3($x);
test4($y);
test5($x);
--EXPECTF--
ok
ok
ok
ok

Catchable 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