Example #1
0
function main()
{
    $a = new a();
    $x = new x();
    echo "Calling a->pub\n";
    $a->pub();
    echo "Calling x->pub\n";
    $x->pub();
}
Example #2
0
 function y()
 {
     $this->privatep = 2;
     $this->privatepa[] = 3;
     self::$privatepsself = 4;
     static::$privatepsstatic = 5;
 }
 function y2($property2, $property4, $property2y, $property4y)
 {
     self::$property2 = $property2;
     self::$property4 = $property4;
     self::$property2y = $property2y;
     self::$property4y = $property4y;
 }
Example #4
0
 function y()
 {
     $this->defined = 1;
     $this->undefinedButMagic = 2;
     $y->undefinedButNotInternal = 3;
     // static calls
     x::$y = 2;
 }
Example #5
0
 function y()
 {
     self::$staticPropertySelf = 6;
     static::$staticPropertyStatic = 7;
     x::$staticPropertyx = 8;
     \x::$staticPropertyxFNS = 9;
     \otherClass::$staticPropertyxFNS = 10;
     parent::$staticPropertySelf = 11;
 }
Example #6
0
 public static function go()
 {
     self::$k = new y();
     for ($i = 0; $i < 10; ++$i) {
         self::$set = $i;
         // enough to fool hphpc into leaving the
         // IssetS,EmptyS opcodes
         var_dump(empty(self::$set));
         var_dump(isset(self::$set));
     }
 }
Example #7
0
 function y()
 {
     //        self::$staticPropertySelf = 6;
     static::$staticPropertyStatic = 7;
     parent::$staticPropertyParent = 11;
     x::$staticPropertyx = 8;
     \x::$staticPropertyxFNS = 9;
     w::$staticPropertyw = 8;
     \w::$staticPropertywFNS = 9;
     \otherClass::$staticPropertyxFNS = 10;
 }
Example #8
0
 function y()
 {
     //        self::$staticPropertySelf = 6;
     static::$staticPropertyStatic = 7;
     // undeclared
     x::$staticPropertyx = 8;
     \x::$staticPropertyxFNS = 9;
     w::$staticPropertyx = 8;
     \w::$staticPropertyxFNS = 9;
     \otherClass::$staticPropertyxFNS = 10;
 }
Example #9
0
 function y()
 {
     echo x::e;
     echo \x::e;
     echo static::e;
     echo parent::e;
     echo x::$p;
     echo \x::$p;
     echo static::$p;
     echo parent::$p;
     echo x::method();
     echo \x::method();
     echo static::method();
     echo parent::method();
 }
Example #10
0
 function y()
 {
     self::$staticPropertySelf1 = 6;
     static::$staticPropertyStatic1 = 7;
     x::$staticPropertyx1 = 8;
     \x::$staticPropertyxFNS1 = 9;
     \otherClass::$staticPropertyxFNS1 = 10;
     parent::$staticPropertySelf1 = 11;
     self::$staticPropertySelf2 = 6;
     static::$staticPropertyStatic2 = 7;
     x::$staticPropertyx2 = 8;
     \x::$staticPropertyxFNS2 = 9;
     \otherClass::$staticPropertyxFNS2 = 10;
     parent::$staticPropertySelf2 = 11;
     self::$staticPropertySelf3 = 6;
     static::$staticPropertyStatic3 = 7;
     x::$staticPropertyx3 = 8;
     \x::$staticPropertyxFNS3 = 9;
     \otherClass::$staticPropertyxFNS3 = 10;
     parent::$staticPropertySelf3 = 11;
 }
<?php

class x
{
    function abc()
    {
    }
    static function sabc()
    {
    }
}
abC();
// dummy
sabC();
// dummy
new aBc();
// dummy
new saBc();
// dummy
$x->ABC();
$x->abc();
$x->sabC();
x::Sabc();
x::sabc();
Example #12
0
<?php

class x
{
    function init()
    {
        $names = range('a', 'g');
        foreach ($names as $n) {
            $this[$n];
        }
        $this[] = 3;
    }
}
$X = new x();
$X->init();
print_r($X);
 function y2($property2, $property4)
 {
     self::$property2 = $property2;
     self::$property4 = $property4;
 }
Example #14
0
{
    public function bf();
}
interface c
{
    public function cf();
}
class x implements a, b, c
{
    public function af()
    {
        echo 'af<br/>';
    }
    public function aaf()
    {
        echo 'aaf<br/>';
    }
    public function bf()
    {
        echo 'bf<br/>';
    }
    public function cf()
    {
        echo 'cf<br/>';
    }
}
$xy = new x();
$xy->af();
$xy->aaf();
$xy->bf();
$xy->cf();
Example #15
0
<?php

if (x::b('c', 3)) {
    $a = 1;
}
Example #16
0
 public static function go()
 {
     self::$heh = array();
     self::$heh->bar = 0;
     // we should know this can't affect $this->bar
 }
Example #17
0
<?php

function definedFunction()
{
}
definedFunction();
undefinedFunction();
definedMethodUsedAsFunction();
$x->definedMethod();
x::definedStaticMethod();
class x
{
    function definedMethod()
    {
    }
    static function definedStaticMethod()
    {
    }
    function definedMethodUsedAsFunction()
    {
    }
}
Example #18
0
 /**
  * Parses a string by a set of available methods
  *
  * Available methods:
  * - json
  * - xml
  * - url
  * - query
  * - php
  *
  * @param  string  $string
  * @param  string  $mode
  * @return string
  */
 static function parse($string, $mode = 'json')
 {
     if (is_array($string)) {
         return $string;
     }
     switch ($mode) {
         case 'json':
             $result = (array) @json_decode($string, true);
             break;
         case 'xml':
             $result = x::parse($string);
             break;
         case 'url':
             $result = (array) @parse_url($string);
             break;
         case 'query':
             if (url::has_query($string)) {
                 $string = self::split($string, '?');
                 $string = a::last($string);
             }
             @parse_str($string, $result);
             break;
         case 'php':
             $result = @unserialize($string);
             break;
         default:
             $result = $string;
             break;
     }
     return $result;
 }
Example #19
0
 function y()
 {
     self::$usedInside = 3;
 }
Example #20
0
<?php

class x
{
    static function define()
    {
    }
}
$X->define('a', 2);
// can't be found
x::define('b', 4);
// can't be found
$x::define('c', 6);
// can't be found
define('d', 7);
// must be found
Example #21
0
<?php

class x
{
    public $used = 1;
    public $uSed = 1;
    public $uSEd = 1;
    public $unused = 2;
    public $unUsed = 2;
    public $unUSed = 2;
    public $usedInside = 3;
    public $used_inside_various_cases = 3;
    public $used_INSIDE_various_cases = 3;
    public static $usedButStatic = 4;
    function y()
    {
        $this->usedInside = 3;
        $this->used_inside_various_cases = 5;
        $this->used_INSIDE_various_cases = 6;
    }
}
$x->used = 4;
$x->uSed = 4;
$x->uSEd = 4;
$x->usedButStatic = 3;
\x::$usedButStatic = 5;
Example #22
0
<?php

class x
{
    static function y()
    {
    }
}
x::Y();
x::x();
X::y();
x::y();
Example #23
0
 function foo()
 {
     parent::bar();
     parent::bar();
 }
Example #24
0
{
    function usedMethod()
    {
    }
    function definedTwiceMethod()
    {
    }
    function unusedMethod()
    {
    }
    function methodNamedAsAFunction()
    {
    }
    function usedMethodNoCase()
    {
    }
    function usedMethodStatically()
    {
    }
}
class y
{
    function definedTwiceMethod()
    {
    }
}
$y->usedMethod();
$yy->definedTwiceMethod();
$xxx->usedmethodnocase();
x::usedMethodStatically();
methodNamedAsAFunction();
<?php

class x
{
    public function abc()
    {
        print __METHOD__ . "\n";
    }
    static function sabc()
    {
        print __METHOD__ . "\n";
    }
}
$a = new x();
$a->abc();
// OK
$a->sabc();
// Possible but weird
x::abc();
// Should not be possible but actually is
x::sabc();
// OK
Example #26
0
<?php

class x
{
    static $staticReadWithSelf = array(1, 2, 3);
    static $staticReadWithStatic = array(1, 2, 4);
    static $staticModifiedWithSelf = array(1, 2, 5);
    static $staticModifiedWithStatic = array(1, 2, 6);
    static $staticModifiedWithThis = array(1, 2, 7);
    function y()
    {
        $a = self::$staticReadWithSelf;
        $b = static::$staticReadWithStatic;
        $a = self::$staticModifiedWithSelf++;
        static::$staticModifiedWithStatic[] = 1;
        $this->staticModifiedWithThis = 1;
    }
}
$z = new x();
$z->y();
print x::$staticModifiedWithThis;