File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug42802.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #42802 (Namespace not supported in typehints)
    3: --FILE--
    4: <?php
    5: namespace foo;
    6: 
    7: class bar {
    8: }
    9: 
   10: function test1(bar $bar) {
   11: 	echo "ok\n";
   12: }
   13: 
   14: function test2(\foo\bar $bar) {
   15:         echo "ok\n";
   16: }
   17: function test3(\foo\bar $bar) {
   18:         echo "ok\n";
   19: }
   20: function test4(\Exception $e) {
   21: 	echo "ok\n";
   22: }
   23: function test5(\bar $bar) {
   24:         echo "bug\n";
   25: }
   26: 
   27: $x = new bar();
   28: $y = new \Exception();
   29: test1($x);
   30: test2($x);
   31: test3($x);
   32: test4($y);
   33: test5($x);
   34: --EXPECTF--
   35: ok
   36: ok
   37: ok
   38: ok
   39: 
   40: 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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>