mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Fixed bug #55825, and add test script
This commit is contained in:
parent
24cbd8f3fe
commit
2e925f6f19
2
NEWS
2
NEWS
@ -12,6 +12,8 @@ PHP NEWS
|
||||
(Felipe, Laruence)
|
||||
. Fixed bug #55758 (Digest Authenticate missed in 5.4) . (Laruence)
|
||||
. Fixed bug #55622 (memory corruption in parse_ini_string). (Pierre)
|
||||
. Fixed bug #55825 (Missing initial value of static locals in trait methods).
|
||||
(Laruence)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #55544 (ob_gzhandler always conflicts with
|
||||
|
17
Zend/tests/bug55825.phpt
Normal file
17
Zend/tests/bug55825.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #55825 (Missing initial value of static locals in trait methods)
|
||||
--FILE--
|
||||
<?php
|
||||
trait T1 {
|
||||
public function inc() {
|
||||
static $x=1;
|
||||
echo $x++ . "\n";
|
||||
}
|
||||
}
|
||||
class C { use T1; }
|
||||
$c1 = new C;
|
||||
$c1->inc();
|
||||
$c1->inc();
|
||||
--EXPECT--
|
||||
1
|
||||
2
|
@ -3695,7 +3695,7 @@ static void zend_traits_duplicate_function(zend_function *fe, zend_class_entry *
|
||||
|
||||
ALLOC_HASHTABLE(tmpHash);
|
||||
zend_hash_init(tmpHash, zend_hash_num_elements(fe->op_array.static_variables), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_apply_with_arguments(tmpHash TSRMLS_CC, (apply_func_args_t)zval_copy_static_var, 1, fe->op_array.static_variables);
|
||||
zend_hash_apply_with_arguments(fe->op_array.static_variables TSRMLS_CC, (apply_func_args_t)zval_copy_static_var, 1, tmpHash);
|
||||
|
||||
fe->op_array.static_variables = tmpHash;
|
||||
}
|
||||
@ -4101,6 +4101,7 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
|
||||
zend_hash_graceful_destroy(resulting_table);
|
||||
free(resulting_table);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user