Skip to content

Commit 2527a0f

Browse files
Massimiliano Braglianikic
authored andcommitted
Fixed bug #75797
Fix zend_register_class_alias_ex() to use non-persistent strings for (non-persistent) userland classes.
1 parent 7ad0595 commit 2527a0f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ PHP NEWS
66
. Fixed bug #76754 (parent private constant in extends class memory leak).
77
(Laruence)
88
. Fixed bug #72443 (Generate enabled extension). (petk)
9+
. Fixed bug #75797 (Memory leak when using class_alias() in non-debug mode).
10+
(Massimiliano Braglia)
911

1012
- Bz2:
1113
. Fixed arginfo for bzcompress. (Tyson Andre)

Zend/zend_API.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,12 +2774,15 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or
27742774
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce) /* {{{ */
27752775
{
27762776
zend_string *lcname;
2777+
int persistent;
2778+
2779+
persistent = ce->type != ZEND_USER_CLASS;
27772780

27782781
if (name[0] == '\\') {
2779-
lcname = zend_string_alloc(name_len-1, 1);
2782+
lcname = zend_string_alloc(name_len-1, persistent);
27802783
zend_str_tolower_copy(ZSTR_VAL(lcname), name+1, name_len-1);
27812784
} else {
2782-
lcname = zend_string_alloc(name_len, 1);
2785+
lcname = zend_string_alloc(name_len, persistent);
27832786
zend_str_tolower_copy(ZSTR_VAL(lcname), name, name_len);
27842787
}
27852788

0 commit comments

Comments
 (0)