예제 #1
0
파일: bug41961.php 프로젝트: badlamer/hhvm
<?php

X::test();
/** Class X is related to neither ParentClass nor ChildClass. */
class X
{
    public static function test()
    {
        $myChild = new ChildClass();
        $myChild->secret();
        // bug - invokes X::secret() instead of ChildClass::secret()
    }
    private function secret()
    {
        echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
    }
}
class ParentClass
{
    private function secret()
    {
    }
}
class ChildClass extends ParentClass
{
    public function secret()
    {
        echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
    }
}
예제 #2
0
파일: fail_self.php 프로젝트: badlamer/hhvm
<?php

class X
{
    function test(self $s)
    {
        var_dump($s);
    }
}
X::test("hello");
예제 #3
0
파일: bind-null.php 프로젝트: ezoic/hhvm
<?php

class X
{
    static function test()
    {
        $f = function () {
            get_called_class();
        };
        $g = $f->bindto(null, null);
        return $g;
    }
}
$f = X::test();
$f();
예제 #4
0
파일: 1386.php 프로젝트: badlamer/hhvm
<?php

class X
{
    static function test()
    {
        var_dump(__FUNCTION__);
        var_dump(__CLASS__);
        var_dump(__METHOD__);
        return array($GLOBALS[__FUNCTION__], $GLOBALS[__CLASS__], $GLOBALS[__METHOD__]);
    }
}
$test = 'this_is_function_test';
$X = 'this_is_class_x';
$GLOBALS['X::test'] = 'this_is_method_test::x';
var_dump(X::test());
예제 #5
0
    }
}
class C extends B
{
    private $hiddenPriv = 'C::hiddenPriv';
    public static function test($b)
    {
        echo __METHOD__ . "\n";
        var_dump(get_object_vars($b));
    }
}
class X
{
    public static function test($b)
    {
        echo __METHOD__ . "\n";
        var_dump(get_object_vars($b));
    }
}
$b = new B();
echo "\n---( Global scope: )---\n";
var_dump(get_object_vars($b));
echo "\n---( Declaring class: )---\n";
B::test($b);
echo "\n---( Subclass: )---\n";
C::test($b);
echo "\n---( Superclass: )---\n";
A::test($b);
echo "\n---( Unrelated class: )---\n";
X::test($b);
예제 #6
0
파일: 1287.php 프로젝트: badlamer/hhvm
function test($a)
{
    $x = new X();
    return $a ? $x->test(1, 2) : false;
}
예제 #7
0
파일: 771.php 프로젝트: badlamer/hhvm
<?php

class X
{
    public function __invoke($x)
    {
        var_dump($x);
    }
    public function test()
    {
        $this(10);
        call_user_func($this, 300);
        call_user_func_array($this, array(0, 1));
    }
}
class Y
{
    public function test($x)
    {
        $x(10);
        call_user_func($x, 300);
        call_user_func_array($x, array(0, 1));
    }
}
$x = new X();
$x->test();
$y = new Y();
$y->test($x);
예제 #8
0
<?php

class X
{
    public $foo;
    function test()
    {
        $a = array(null => $this->foo);
        return $a;
    }
}
$x = new X();
var_dump($x->test());