Skip to content

Commit 0493842

Browse files
authored
Fix soap crash with ZEND_RC_DEBUG (#12514)
1 parent 23e4e3b commit 0493842

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ext/soap/php_sdl.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
154154
new_enc->details.type_str = estrdup(new_enc->details.type_str);
155155
}
156156
if (new_enc->details.clark_notation) {
157-
zend_string_addref(new_enc->details.clark_notation);
157+
/* If it was persistent or becomes persistent, we must dup. Otherwise we can copy. */
158+
bool was_persistent = GC_FLAGS(new_enc->details.clark_notation) & IS_STR_PERSISTENT;
159+
if (was_persistent || sdl->is_persistent) {
160+
new_enc->details.clark_notation = zend_string_dup(new_enc->details.clark_notation, sdl->is_persistent);
161+
} else {
162+
zend_string_addref(new_enc->details.clark_notation);
163+
}
158164
}
159165
if (sdl->encoders == NULL) {
160166
sdl->encoders = pemalloc(sizeof(HashTable), sdl->is_persistent);

0 commit comments

Comments
 (0)