pear-core: Remove calls with incompatible Context

revision 1609c34f6f64162a99e6808be35b8c1c27b6b732

raw

phork0.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
 * https://github.com/php/php-src/pull/1026
 * https://wiki.php.net/rfc/incompat_ctx
 */
class A
{
    function bNon()
    {
        //i'm not interested in this
        echo "A::bNon\n";
    }
 
    static function cStat()
    {
        if (isset($this)) {
            //static method has been called non-statically
            //$this is instance of A
            echo '$a->cStat' . "\n";
        } else {
            //static method has been called statically
            echo "A::cStat\n";
        }
    }
 
    static function dStaticVarHack()
    {
        $his = 'this';
        if (isset($$his)) {
            //static method has been called non-statically
            //$this is instance of A
            echo '$a->dStaticVarHack' . "\n";
        } else {
            //static method has been called statically
            echo "A::dStaticVarHack\n";
        }
    }
 
    static function eVarHack()
    {
        $his = 'this';
        if (isset($$his)) {
            //method has been called non-statically
            //$this is instance of A
            echo '$a->eVarHack' . "\n";
        } else {
            //method has been called statically
            echo "A::eVarHack\n";
        }
    }
}
 
//this should fail, that's fine
A::bNon();
 
//but this should work both:
A::cStat();
$a = new A();
$a->cStat();
 
//but this should work both:
A::dStaticVarHack();
$a = new A();
$a->dStaticVarHack();
 
A::eVarHack();
$a = new A();
$a->eVarHack();
 
?>
 

History