@@ -4269,12 +4269,9 @@ PHPAPI void php_stripslashes(zend_string *str)
4269
4269
*/
4270
4270
static zend_long php_str_replace_in_subject (zval * search , zval * replace , zval * subject , zval * result , int case_sensitivity )
4271
4271
{
4272
- zval * search_entry ,
4273
- * replace_entry = NULL ;
4272
+ zval * search_entry ;
4274
4273
zend_string * tmp_result ,
4275
- * tmp_subject_str ,
4276
- * tmp_replace_entry_str = NULL ,
4277
- * replace_entry_str ;
4274
+ * tmp_subject_str ;
4278
4275
char * replace_value = NULL ;
4279
4276
size_t replace_len = 0 ;
4280
4277
zend_long replace_count = 0 ;
@@ -4308,10 +4305,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
4308
4305
/* Make sure we're dealing with strings. */
4309
4306
zend_string * tmp_search_str ;
4310
4307
zend_string * search_str = zval_get_tmp_string (search_entry , & tmp_search_str );
4308
+ zend_string * replace_entry_str , * tmp_replace_entry_str = NULL ;
4311
4309
4312
4310
/* If replace is an array. */
4313
4311
if (Z_TYPE_P (replace ) == IS_ARRAY ) {
4314
4312
/* Get current entry */
4313
+ zval * replace_entry = NULL ;
4315
4314
while (replace_idx < Z_ARRVAL_P (replace )-> nNumUsed ) {
4316
4315
replace_entry = & Z_ARRVAL_P (replace )-> arData [replace_idx ].val ;
4317
4316
if (Z_TYPE_P (replace_entry ) != IS_UNDEF ) {
@@ -4368,15 +4367,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
4368
4367
}
4369
4368
} else {
4370
4369
zend_tmp_string_release (tmp_search_str );
4370
+ zend_tmp_string_release (tmp_replace_entry_str );
4371
4371
continue ;
4372
4372
}
4373
4373
4374
4374
zend_tmp_string_release (tmp_search_str );
4375
-
4376
- if (tmp_replace_entry_str ) {
4377
- zend_string_release_ex (tmp_replace_entry_str , 0 );
4378
- tmp_replace_entry_str = NULL ;
4379
- }
4375
+ zend_tmp_string_release (tmp_replace_entry_str );
4380
4376
4381
4377
if (subject_str == tmp_result ) {
4382
4378
zend_string_delref (subject_str );
0 commit comments