some builtin classes). (Laruence)
. Fixed bug #62955 (Only one directive is loaded from "Per Directory Values"
Windows registry). (aserbulov at parallels dot com)
+ . Fixed bug #62907 (Double free when use traits). (Dmitry)
- SOAP
. Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice).
--TEST--
Bug #62907 (Double free when use traits)
---XFAIL--
-bug is not fixed yet
--FILE--
<?php
function __autoload($name) {
&& (zend_binary_strcasecmp(aliases[i]->trait_method->method_name, aliases[i]->trait_method->mname_len, fn->common.function_name, fnname_len) == 0)) {
fn_copy = *fn;
function_add_ref(&fn_copy);
- /* this function_name is never destroyed, because its refcount
- greater than 1 and classes are always destoyed before the
- traits they use */
+ /* this function_name is never destroyed, because ZEND_ACC_ALIAS
+ flag is set */
fn_copy.common.function_name = aliases[i]->alias;
+ fn_copy.common.fn_flags |= ZEND_ACC_ALIAS;
/* if it is 0, no modifieres has been changed */
if (aliases[i]->modifiers) {
/* is not in hashtable, thus, function is not to be excluded */
fn_copy = *fn;
function_add_ref(&fn_copy);
+ fn_copy.common.fn_flags |= ZEND_ACC_ALIAS;
/* apply aliases which are not qualified by a class name, or which have not
* alias name, just setting visibility */
#define ZEND_ACC_RETURN_REFERENCE 0x4000000
#define ZEND_ACC_DONE_PASS_TWO 0x8000000
+#define ZEND_ACC_ALIAS 0x10000000
+
char *zend_visibility_string(zend_uint fn_flags);
}
}
+static int zend_clear_trait_method_name(zend_op_array *op_array TSRMLS_DC)
+{
+ if (op_array->function_name && (op_array->fn_flags & ZEND_ACC_ALIAS) == 0) {
+ efree(op_array->function_name);
+ op_array->function_name = NULL;
+ }
+ return 0;
+}
+
ZEND_API void destroy_zend_class(zend_class_entry **pce)
{
zend_class_entry *ce = *pce;
}
zend_hash_destroy(&ce->properties_info);
str_efree(ce->name);
+ if ((ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ zend_hash_apply(&ce->function_table, (apply_func_t)zend_clear_trait_method_name TSRMLS_CC);
+ }
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
}
efree(op_array->opcodes);
- if (op_array->function_name) {
+ if (op_array->function_name && (op_array->fn_flags & ZEND_ACC_ALIAS) == 0) {
efree((char*)op_array->function_name);
}
if (op_array->doc_comment) {