@@ -4357,12 +4357,9 @@ PHPAPI void php_stripslashes(zend_string *str)
43574357 */
43584358static zend_long php_str_replace_in_subject (zval * search , zval * replace , zval * subject , zval * result , int case_sensitivity )
43594359{
4360- zval * search_entry ,
4361- * replace_entry = NULL ;
4360+ zval * search_entry ;
43624361 zend_string * tmp_result ,
4363- * tmp_subject_str ,
4364- * tmp_replace_entry_str = NULL ,
4365- * replace_entry_str ;
4362+ * tmp_subject_str ;
43664363 char * replace_value = NULL ;
43674364 size_t replace_len = 0 ;
43684365 zend_long replace_count = 0 ;
@@ -4396,10 +4393,12 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
43964393 /* Make sure we're dealing with strings. */
43974394 zend_string * tmp_search_str ;
43984395 zend_string * search_str = zval_get_tmp_string (search_entry , & tmp_search_str );
4396+ zend_string * replace_entry_str , * tmp_replace_entry_str = NULL ;
43994397
44004398 /* If replace is an array. */
44014399 if (Z_TYPE_P (replace ) == IS_ARRAY ) {
44024400 /* Get current entry */
4401+ zval * replace_entry = NULL ;
44034402 while (replace_idx < Z_ARRVAL_P (replace )-> nNumUsed ) {
44044403 replace_entry = & Z_ARRVAL_P (replace )-> arData [replace_idx ].val ;
44054404 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
44564455 }
44574456 } else {
44584457 zend_tmp_string_release (tmp_search_str );
4458+ zend_tmp_string_release (tmp_replace_entry_str );
44594459 continue ;
44604460 }
44614461
44624462 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 );
44684464
44694465 if (subject_str == tmp_result ) {
44704466 zend_string_delref (subject_str );
0 commit comments