summaryrefslogtreecommitdiff
path: root/Zend/tests/self_method_or_prop_outside_class.phpt
blob: e4a499def8a886221279e127af1bc9a7882b0a03 (plain)
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
--TEST--
Accessing self:: properties or methods outside a class
--FILE--
<?php

$fn = function() {
    $str = "foo";
    try {
        self::${$str . "bar"};
    } catch (Error $e) {
        echo $e->getMessage(), "\n";
    }
    try {
        unset(self::${$str . "bar"});
    } catch (Error $e) {
        echo $e->getMessage(), "\n";
    }
    try {
        isset(self::${$str . "bar"});
    } catch (Error $e) {
        echo $e->getMessage(), "\n";
    }
    try {
        self::{$str . "bar"}();
    } catch (Error $e) {
        echo $e->getMessage(), "\n";
    }
};
$fn();

?>
--EXPECT--
Cannot access self:: when no class scope is active
Cannot access self:: when no class scope is active
Cannot access self:: when no class scope is active
Cannot access self:: when no class scope is active