File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -195,9 +195,22 @@ static zend_always_inline zend_string *zend_string_copy(zend_string *s)
195
195
return s ;
196
196
}
197
197
198
+ static zend_always_inline zend_string * zend_string_dup_safe (zend_string * s , bool persistent )
199
+ {
200
+ if (ZSTR_IS_INTERNED (s ) && (!persistent || (GC_FLAGS (s ) & IS_STR_PERSISTENT ))) {
201
+ return s ;
202
+ } else {
203
+ return zend_string_init (ZSTR_VAL (s ), ZSTR_LEN (s ), persistent );
204
+ }
205
+ }
206
+
207
+ /* Callers should use PHP 8.2's definition of zend_string_dup_safe instead,
208
+ if they need a temporary or interned persistent string
209
+ and aren't sure if it might be a temporary (allocated with emalloc) interned string. */
198
210
static zend_always_inline zend_string * zend_string_dup (zend_string * s , bool persistent )
199
211
{
200
212
if (ZSTR_IS_INTERNED (s )) {
213
+ ZEND_ASSERT (!persistent || (GC_FLAGS (s ) & IS_STR_PERSISTENT ));
201
214
return s ;
202
215
} else {
203
216
return zend_string_init (ZSTR_VAL (s ), ZSTR_LEN (s ), persistent );
You can’t perform that action at this time.
0 commit comments