@@ -2026,10 +2026,9 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
2026
2026
return result ;
2027
2027
}
2028
2028
2029
- /* {{{ php_pcre_replace_func */
2030
2029
static zend_always_inline zend_string * php_pcre_replace_func (zend_string * regex ,
2031
2030
zend_string * subject_str ,
2032
- zend_fcall_info * fci , zend_fcall_info_cache * fcc ,
2031
+ zend_fcall_info_cache * fcc ,
2033
2032
size_t limit , size_t * replace_count , zend_long flags )
2034
2033
{
2035
2034
pcre_cache_entry * pce ; /* Compiled regular expression */
@@ -2045,7 +2044,6 @@ static zend_always_inline zend_string *php_pcre_replace_func(zend_string *regex,
2045
2044
2046
2045
return result ;
2047
2046
}
2048
- /* }}} */
2049
2047
2050
2048
/* {{{ php_pcre_replace_array */
2051
2049
static zend_string * php_pcre_replace_array (HashTable * regex ,
@@ -2144,16 +2142,14 @@ static zend_always_inline zend_string *php_replace_in_subject(
2144
2142
}
2145
2143
/* }}} */
2146
2144
2147
- /* {{{ php_replace_in_subject_func */
2148
2145
static zend_string * php_replace_in_subject_func (zend_string * regex_str , HashTable * regex_ht ,
2149
2146
zend_fcall_info * fci , zend_fcall_info_cache * fcc ,
2150
2147
zend_string * subject , size_t limit , size_t * replace_count , zend_long flags )
2151
2148
{
2152
2149
zend_string * result ;
2153
2150
2154
2151
if (regex_str ) {
2155
- result = php_pcre_replace_func (
2156
- regex_str , subject , fci , fcc , limit , replace_count , flags );
2152
+ result = php_pcre_replace_func (regex_str , subject , fcc , limit , replace_count , flags );
2157
2153
return result ;
2158
2154
} else {
2159
2155
/* If regex is an array */
@@ -2166,14 +2162,16 @@ static zend_string *php_replace_in_subject_func(zend_string *regex_str, HashTabl
2166
2162
/* For each entry in the regex array, get the entry */
2167
2163
ZEND_HASH_FOREACH_VAL (regex_ht , regex_entry ) {
2168
2164
/* Make sure we're dealing with strings. */
2169
- zend_string * tmp_regex_entry_str ;
2170
- zend_string * regex_entry_str = zval_get_tmp_string (regex_entry , & tmp_regex_entry_str );
2165
+ zend_string * regex_entry_str = zval_try_get_string (regex_entry );
2166
+ if (UNEXPECTED (regex_entry_str == NULL )) {
2167
+ break ;
2168
+ }
2171
2169
2172
2170
/* Do the actual replacement and put the result back into subject
2173
2171
for further replacements. */
2174
2172
result = php_pcre_replace_func (
2175
- regex_entry_str , subject , fci , fcc , limit , replace_count , flags );
2176
- zend_tmp_string_release ( tmp_regex_entry_str );
2173
+ regex_entry_str , subject , fcc , limit , replace_count , flags );
2174
+ zend_string_release_ex ( regex_entry_str , false );
2177
2175
zend_string_release (subject );
2178
2176
subject = result ;
2179
2177
if (UNEXPECTED (result == NULL )) {
@@ -2184,7 +2182,6 @@ static zend_string *php_replace_in_subject_func(zend_string *regex_str, HashTabl
2184
2182
return subject ;
2185
2183
}
2186
2184
}
2187
- /* }}} */
2188
2185
2189
2186
/* {{{ preg_replace_func_impl */
2190
2187
static size_t preg_replace_func_impl (zval * return_value ,
0 commit comments