@@ -4090,11 +4090,8 @@ PHPAPI void php_stripslashes(zend_string *str)
4090
4090
/* {{{ php_str_replace_in_subject */
4091
4091
static zend_long php_str_replace_in_subject (zval * search , zval * replace , zend_string * subject_str , zval * result , int case_sensitivity )
4092
4092
{
4093
- zval * search_entry ,
4094
- * replace_entry = NULL ;
4095
- zend_string * tmp_result ,
4096
- * tmp_replace_entry_str = NULL ,
4097
- * replace_entry_str ;
4093
+ zval * search_entry ;
4094
+ zend_string * tmp_result ;
4098
4095
char * replace_value = NULL ;
4099
4096
size_t replace_len = 0 ;
4100
4097
zend_long replace_count = 0 ;
@@ -4124,10 +4121,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zend_st
4124
4121
/* Make sure we're dealing with strings. */
4125
4122
zend_string * tmp_search_str ;
4126
4123
zend_string * search_str = zval_get_tmp_string (search_entry , & tmp_search_str );
4124
+ zend_string * replace_entry_str , * tmp_replace_entry_str = NULL ;
4127
4125
4128
4126
/* If replace is an array. */
4129
4127
if (Z_TYPE_P (replace ) == IS_ARRAY ) {
4130
4128
/* Get current entry */
4129
+ zval * replace_entry = NULL ;
4131
4130
while (replace_idx < Z_ARRVAL_P (replace )-> nNumUsed ) {
4132
4131
replace_entry = & Z_ARRVAL_P (replace )-> arData [replace_idx ].val ;
4133
4132
if (Z_TYPE_P (replace_entry ) != IS_UNDEF ) {
@@ -4184,15 +4183,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zend_st
4184
4183
}
4185
4184
} else {
4186
4185
zend_tmp_string_release (tmp_search_str );
4186
+ zend_tmp_string_release (tmp_replace_entry_str );
4187
4187
continue ;
4188
4188
}
4189
4189
4190
4190
zend_tmp_string_release (tmp_search_str );
4191
-
4192
- if (tmp_replace_entry_str ) {
4193
- zend_string_release_ex (tmp_replace_entry_str , 0 );
4194
- tmp_replace_entry_str = NULL ;
4195
- }
4191
+ zend_tmp_string_release (tmp_replace_entry_str );
4196
4192
4197
4193
if (subject_str == tmp_result ) {
4198
4194
zend_string_delref (subject_str );
0 commit comments