@@ -4357,12 +4357,9 @@ PHPAPI void php_stripslashes(zend_string *str)
4357
4357
*/
4358
4358
static zend_long php_str_replace_in_subject (zval * search , zval * replace , zval * subject , zval * result , int case_sensitivity )
4359
4359
{
4360
- zval * search_entry ,
4361
- * replace_entry = NULL ;
4360
+ zval * search_entry ;
4362
4361
zend_string * tmp_result ,
4363
- * tmp_subject_str ,
4364
- * tmp_replace_entry_str = NULL ,
4365
- * replace_entry_str ;
4362
+ * tmp_subject_str ;
4366
4363
char * replace_value = NULL ;
4367
4364
size_t replace_len = 0 ;
4368
4365
zend_long replace_count = 0 ;
@@ -4396,10 +4393,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
4396
4393
/* Make sure we're dealing with strings. */
4397
4394
zend_string * tmp_search_str ;
4398
4395
zend_string * search_str = zval_get_tmp_string (search_entry , & tmp_search_str );
4396
+ zend_string * replace_entry_str , * tmp_replace_entry_str = NULL ;
4399
4397
4400
4398
/* If replace is an array. */
4401
4399
if (Z_TYPE_P (replace ) == IS_ARRAY ) {
4402
4400
/* Get current entry */
4401
+ zval * replace_entry = NULL ;
4403
4402
while (replace_idx < Z_ARRVAL_P (replace )-> nNumUsed ) {
4404
4403
replace_entry = & Z_ARRVAL_P (replace )-> arData [replace_idx ].val ;
4405
4404
if (Z_TYPE_P (replace_entry ) != IS_UNDEF ) {
@@ -4456,15 +4455,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
4456
4455
}
4457
4456
} else {
4458
4457
zend_tmp_string_release (tmp_search_str );
4458
+ zend_tmp_string_release (tmp_replace_entry_str );
4459
4459
continue ;
4460
4460
}
4461
4461
4462
4462
zend_tmp_string_release (tmp_search_str );
4463
-
4464
- if (tmp_replace_entry_str ) {
4465
- zend_string_release_ex (tmp_replace_entry_str , 0 );
4466
- tmp_replace_entry_str = NULL ;
4467
- }
4463
+ zend_tmp_string_release (tmp_replace_entry_str );
4468
4464
4469
4465
if (subject_str == tmp_result ) {
4470
4466
zend_string_delref (subject_str );
0 commit comments