php-src/Zend/tests/traits/language012.phpt
Stefan Marr e6bd5368ad Fixed issue with statics in traits.
#Please review this change, I moved the routine which copies statics from the closure code to zend_variables.c
#Please also have a look to check whether the TSRMLS_DC is correct, and whether it fits with the rest in zend_variables, because there you are using some macro magic and I am not exactly sure what the reason is for that.
2010-06-08 15:56:36 +00:00

28 lines
281 B
PHP

--TEST--
Statics should work in traits, too.
--FILE--
<?php
error_reporting(E_ALL);
trait Counter {
public function inc() {
static $c = 0;
$c = $c + 1;
echo "$c\n";
}
}
class C1 {
use Counter;
}
$o = new C1();
$o->inc();
$o->inc();
?>
--EXPECTF--
1
2