@@ -4269,12 +4269,9 @@ PHPAPI void php_stripslashes(zend_string *str)
42694269 */
42704270static zend_long php_str_replace_in_subject (zval * search , zval * replace , zval * subject , zval * result , int case_sensitivity )
42714271{
4272- zval * search_entry ,
4273- * replace_entry = NULL ;
4272+ zval * search_entry ;
42744273 zend_string * tmp_result ,
4275- * tmp_subject_str ,
4276- * tmp_replace_entry_str = NULL ,
4277- * replace_entry_str ;
4274+ * tmp_subject_str ;
42784275 char * replace_value = NULL ;
42794276 size_t replace_len = 0 ;
42804277 zend_long replace_count = 0 ;
@@ -4308,10 +4305,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
43084305 /* Make sure we're dealing with strings. */
43094306 zend_string * tmp_search_str ;
43104307 zend_string * search_str = zval_get_tmp_string (search_entry , & tmp_search_str );
4308+ zend_string * replace_entry_str , * tmp_replace_entry_str = NULL ;
43114309
43124310 /* If replace is an array. */
43134311 if (Z_TYPE_P (replace ) == IS_ARRAY ) {
43144312 /* Get current entry */
4313+ zval * replace_entry = NULL ;
43154314 while (replace_idx < Z_ARRVAL_P (replace )-> nNumUsed ) {
43164315 replace_entry = & Z_ARRVAL_P (replace )-> arData [replace_idx ].val ;
43174316 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
43684367 }
43694368 } else {
43704369 zend_tmp_string_release (tmp_search_str );
4370+ zend_tmp_string_release (tmp_replace_entry_str );
43714371 continue ;
43724372 }
43734373
43744374 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 );
43804376
43814377 if (subject_str == tmp_result ) {
43824378 zend_string_delref (subject_str );
0 commit comments