6 changed files with 94 additions and 72 deletions
-
75NEWS
-
12Zend/zend_language_parser.y
-
20tests/lang/041.phpt
-
19tests/lang/042.phpt
-
19tests/lang/043.phpt
-
21tests/lang/044.phpt
@ -0,0 +1,20 @@ |
|||
--TEST-- |
|||
Dynamic access of static members |
|||
--FILE-- |
|||
<?php |
|||
class A { |
|||
public static $b = 'foo'; |
|||
} |
|||
|
|||
$classname = 'A'; |
|||
$wrongClassname = 'B'; |
|||
|
|||
echo $classname::$b."\n"; |
|||
echo $wrongClassname::$b."\n"; |
|||
|
|||
?> |
|||
===DONE=== |
|||
--EXPECTF-- |
|||
foo |
|||
|
|||
Fatal error: Class 'B' not found in %s041.php on line %d |
|||
@ -0,0 +1,19 @@ |
|||
--TEST-- |
|||
Dynamic access of constants |
|||
--FILE-- |
|||
<?php |
|||
class A { |
|||
const B = 'foo'; |
|||
} |
|||
|
|||
$classname = 'A'; |
|||
$wrongClassname = 'B'; |
|||
|
|||
echo $classname::B."\n"; |
|||
echo $wrongClassname::B."\n"; |
|||
?> |
|||
===DONE=== |
|||
--EXPECTF-- |
|||
foo |
|||
|
|||
Fatal error: Class 'B' not found in %s042.php on line %d |
|||
@ -0,0 +1,19 @@ |
|||
--TEST-- |
|||
Dynamic call for static methods |
|||
--FILE-- |
|||
<?php |
|||
class A { |
|||
static function foo() { return 'foo'; } |
|||
} |
|||
|
|||
$classname = 'A'; |
|||
$wrongClassname = 'B'; |
|||
|
|||
echo $classname::foo()."\n"; |
|||
echo $wrongClassname::foo()."\n"; |
|||
?> |
|||
===DONE=== |
|||
--EXPECTF-- |
|||
foo |
|||
|
|||
Fatal error: Class 'B' not found in %s043.php on line %d |
|||
@ -0,0 +1,21 @@ |
|||
--TEST-- |
|||
Dynamic call for static methods dynamically named |
|||
--FILE-- |
|||
<?php |
|||
class A { |
|||
static function foo() { return 'foo'; } |
|||
} |
|||
$classname = 'A'; |
|||
$wrongClassname = 'B'; |
|||
|
|||
$methodname = 'foo'; |
|||
|
|||
echo $classname::$methodname()."\n"; |
|||
|
|||
echo $wrongClassname::$methodname()."\n"; |
|||
?> |
|||
===DONE=== |
|||
--EXPECTF-- |
|||
foo |
|||
|
|||
Fatal error: Class 'B' not found in %s044.php on line %d |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue