summaryrefslogtreecommitdiff
path: root/Zend/tests/bug42802.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-10-01 10:37:14 +0000
committerDmitry Stogov <dmitry@php.net>2007-10-01 10:37:14 +0000
commit41e9b6b61c33d0a3d8bdb00f4c139e4af3e72807 (patch)
treee9f7f56c90b3855262152fa67cbb02e0a561c304 /Zend/tests/bug42802.phpt
parent3a3a7e74417cdef486e469045a5693d44dfa191a (diff)
downloadphp-git-41e9b6b61c33d0a3d8bdb00f4c139e4af3e72807.tar.gz
Fixed bug #42802 (Namespace not supported in typehints)
Diffstat (limited to 'Zend/tests/bug42802.phpt')
-rwxr-xr-xZend/tests/bug42802.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/Zend/tests/bug42802.phpt b/Zend/tests/bug42802.phpt
new file mode 100755
index 0000000000..80ae02ba5e
--- /dev/null
+++ b/Zend/tests/bug42802.phpt
@@ -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