Skip to content

Commit 7435ab3

Browse files
committed
Fix zend_test interned strings loaded via dl()
1 parent c6b5e29 commit 7435ab3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/zend_test/test.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static const zend_function_entry zend_test_trait_methods[] = {
192192
PHP_MINIT_FUNCTION(zend_test)
193193
{
194194
zend_class_entry class_entry;
195+
zend_bool persistent_str = EG(current_module)->type == MODULE_PERSISTENT;
195196

196197
INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
197198
zend_test_interface = zend_register_internal_interface(&class_entry);
@@ -205,7 +206,7 @@ PHP_MINIT_FUNCTION(zend_test)
205206
zend_declare_property_null(zend_test_class, "_StaticProp", sizeof("_StaticProp") - 1, ZEND_ACC_STATIC);
206207

207208
{
208-
zend_string *name = zend_string_init("intProp", sizeof("intProp") - 1, 1);
209+
zend_string *name = zend_string_init("intProp", sizeof("intProp") - 1, persistent_str);
209210
zval val;
210211
ZVAL_LONG(&val, 123);
211212
zend_declare_typed_property(
@@ -214,7 +215,7 @@ PHP_MINIT_FUNCTION(zend_test)
214215
}
215216

216217
{
217-
zend_string *name = zend_string_init("classProp", sizeof("classProp") - 1, 1);
218+
zend_string *name = zend_string_init("classProp", sizeof("classProp") - 1, persistent_str);
218219
zend_string *class_name = zend_string_init("stdClass", sizeof("stdClass") - 1, 1);
219220
zval val;
220221
ZVAL_NULL(&val);
@@ -225,7 +226,7 @@ PHP_MINIT_FUNCTION(zend_test)
225226
}
226227

227228
{
228-
zend_string *name = zend_string_init("staticIntProp", sizeof("staticIntProp") - 1, 1);
229+
zend_string *name = zend_string_init("staticIntProp", sizeof("staticIntProp") - 1, persistent_str);
229230
zval val;
230231
ZVAL_LONG(&val, 123);
231232
zend_declare_typed_property(

0 commit comments

Comments
 (0)