1--TEST-- 2Accessing self:: properties or methods outside a class 3--FILE-- 4<?php 5 6$fn = function() { 7 $str = "foo"; 8 try { 9 self::${$str . "bar"}; 10 } catch (Error $e) { 11 echo $e->getMessage(), "\n"; 12 } 13 try { 14 unset(self::${$str . "bar"}); 15 } catch (Error $e) { 16 echo $e->getMessage(), "\n"; 17 } 18 try { 19 isset(self::${$str . "bar"}); 20 } catch (Error $e) { 21 echo $e->getMessage(), "\n"; 22 } 23 try { 24 self::{$str . "bar"}(); 25 } catch (Error $e) { 26 echo $e->getMessage(), "\n"; 27 } 28}; 29$fn(); 30 31?> 32--EXPECT-- 33Cannot access "self" when no class scope is active 34Cannot access "self" when no class scope is active 35Cannot access "self" when no class scope is active 36Cannot access "self" when no class scope is active 37