]> granicus.if.org Git - php/commitdiff
- New test
authorFelipe Pena <felipe@php.net>
Wed, 4 Jun 2008 18:34:12 +0000 (18:34 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 4 Jun 2008 18:34:12 +0000 (18:34 +0000)
Zend/tests/bug45180.phpt [new file with mode: 0644]

diff --git a/Zend/tests/bug45180.phpt b/Zend/tests/bug45180.phpt
new file mode 100644 (file)
index 0000000..887a159
--- /dev/null
@@ -0,0 +1,61 @@
+--TEST--
+Testing callback formats within class method
+--FILE--
+<?php
+
+class foo {
+       public function test() {
+               call_user_func(array('FOO', 'ABC'));
+               call_user_func(array($this, 'ABC'));
+               foo::XYZ();
+               self::WWW();
+               call_user_func('FOO::ABC');
+       }
+       function __call($a, $b) {
+               print "__call:\n";
+               var_dump($a);
+       }
+       static public function __callStatic($a, $b) {
+               print "__callstatic:\n";
+               var_dump($a);
+       }
+}
+
+$x = new foo;
+
+$x->test();
+
+$x::A();
+
+foo::B();
+
+$f = 'FOO';
+
+$f::C();
+
+$f::$f();
+
+foo::$f();
+
+?>
+--EXPECT--
+__call:
+unicode(3) "ABC"
+__call:
+unicode(3) "ABC"
+__call:
+unicode(3) "XYZ"
+__call:
+unicode(3) "WWW"
+__call:
+unicode(3) "ABC"
+__callstatic:
+unicode(1) "A"
+__callstatic:
+unicode(1) "B"
+__callstatic:
+unicode(1) "C"
+__callstatic:
+unicode(3) "FOO"
+__callstatic:
+unicode(3) "FOO"