1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 00:48:25 +02:00
Files
archived-php-src/tests/lang/bug23384.phpt
T
Marcus Boerger 3ca44539a1 Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling
internal non-static methods statically.
# As discussed with Zeev:
# - For BC standard userspace methods allow this with an E_STRICT message.
# - If you want to implement an internal method taht can be called both
#   statically and non-statically then use flag ZEND_ACC_ALLOW_STATIC.
# - Magic user space methods __*() cannot and __construct, __destruct,
# __clone can never be called statically.
2004-01-24 16:59:24 +00:00

34 lines
573 B
PHP

--TEST--
Bug #23384 (use of class constants in statics)
--INI--
error_reporting=4095
--FILE--
<?php
define('TEN', 10);
class Foo {
const HUN = 100;
function test($x = Foo::HUN) {
static $arr2 = array(TEN => 'ten');
static $arr = array(Foo::HUN => 'ten');
print_r($arr);
print_r($arr2);
print_r($x);
}
}
Foo::test();
echo Foo::HUN."\n";
?>
--EXPECTF--
Strict Standards: Non-static method Foo::test() cannot be called statically in %sbug23384.php on line %d
Array
(
[100] => ten
)
Array
(
[10] => ten
)
100100