summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bz2/bz2.c4
-rw-r--r--ext/curl/interface.c4
-rw-r--r--ext/curl/multi.c2
-rw-r--r--ext/date/php_date.c6
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/hash/hash.c14
-rw-r--r--ext/iconv/iconv.c2
-rw-r--r--ext/intl/locale/locale_methods.c2
-rw-r--r--ext/mysqli/mysqli_api.c2
-rw-r--r--ext/opcache/ZendAccelerator.c2
-rw-r--r--ext/openssl/openssl.c2
-rw-r--r--ext/pcre/php_pcre.c2
-rw-r--r--ext/pgsql/pgsql.c10
-rw-r--r--ext/reflection/php_reflection.c30
-rw-r--r--ext/session/session.c8
-rw-r--r--ext/shmop/shmop.c2
-rw-r--r--ext/soap/soap.c10
-rw-r--r--ext/sockets/sockets.c2
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/spl/spl_iterators.c6
-rw-r--r--ext/spl/spl_observer.c2
-rw-r--r--ext/standard/array.c10
-rw-r--r--ext/standard/http.c2
-rw-r--r--ext/standard/string.c18
-rw-r--r--ext/standard/var.c4
-rw-r--r--ext/wddx/wddx.c6
-rw-r--r--ext/xsl/xsltprocessor.c2
-rw-r--r--ext/zip/php_zip.c4
29 files changed, 82 insertions, 82 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index e4b283e78a..52810719cc 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -379,7 +379,7 @@ static PHP_FUNCTION(bzread)
data->len = php_stream_read(stream, data->val, data->len);
data->val[data->len] = '\0';
- RETURN_STR(data);
+ RETURN_NEW_STR(data);
}
/* }}} */
@@ -545,7 +545,7 @@ static PHP_FUNCTION(bzcompress)
so we erealloc() the buffer to the proper size */
dest->len = dest_len;
dest->val[dest->len] = '\0';
- RETURN_STR(dest);
+ RETURN_NEW_STR(dest);
}
}
/* }}} */
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 650bc158eb..e7f378c8a9 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2862,7 +2862,7 @@ PHP_FUNCTION(curl_exec)
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
smart_str_0(&ch->handlers->write->buf);
- RETURN_STR(zend_string_copy(ch->handlers->write->buf.s));
+ RETURN_STR_COPY(ch->handlers->write->buf.s);
}
/* flush the file handle, so any remaining data is synched to disk */
@@ -3009,7 +3009,7 @@ PHP_FUNCTION(curl_getinfo)
switch (option) {
case CURLINFO_HEADER_OUT:
if (ch->header.str) {
- RETURN_STR(zend_string_copy(ch->header.str));
+ RETURN_STR_COPY(ch->header.str);
} else {
RETURN_FALSE;
}
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 0cd4ae2761..240580cbcd 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -264,7 +264,7 @@ PHP_FUNCTION(curl_multi_getcontent)
RETURN_EMPTY_STRING();
}
smart_str_0(&ch->handlers->write->buf);
- RETURN_STR(zend_string_copy(ch->handlers->write->buf.s));
+ RETURN_STR_COPY(ch->handlers->write->buf.s);
}
RETURN_NULL();
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index ffdea3d090..1946dacda1 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1681,7 +1681,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (real_len && real_len != buf_len) {
buf = zend_string_realloc(buf, real_len, 0);
- RETURN_STR(buf);
+ RETURN_NEW_STR(buf);
}
zend_string_free(buf);
RETURN_FALSE;
@@ -3742,7 +3742,7 @@ PHP_FUNCTION(timezone_name_get)
abs(utc_offset / 60),
abs((utc_offset % 60)));
- RETURN_STR(tmpstr);
+ RETURN_NEW_STR(tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
@@ -4681,7 +4681,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
switch (retformat) {
case SUNFUNCS_RET_STRING:
retstr = strpprintf(0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
- RETURN_STR(retstr);
+ RETURN_NEW_STR(retstr);
break;
case SUNFUNCS_RET_DOUBLE:
RETURN_DOUBLE(N);
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 4d8e4c9bc6..45b86b2932 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1149,7 +1149,7 @@ ZEND_FUNCTION(gmp_export)
mpz_export(out_string->val, NULL, order, size, endian, 0, gmpnumber);
out_string->val[out_len] = '\0';
- RETURN_STR(out_string);
+ RETURN_NEW_STR(out_string);
}
FREE_GMP_TEMP(temp_a);
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 4c4f96fc89..40563708e7 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -167,14 +167,14 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
if (raw_output) {
digest->val[ops->digest_size] = 0;
- RETURN_STR(digest);
+ RETURN_NEW_STR(digest);
} else {
zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
hex_digest->val[2 * ops->digest_size] = 0;
zend_string_release(digest);
- RETURN_STR(hex_digest);
+ RETURN_NEW_STR(hex_digest);
}
}
/* }}} */
@@ -293,14 +293,14 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
if (raw_output) {
digest->val[ops->digest_size] = 0;
- RETURN_STR(digest);
+ RETURN_NEW_STR(digest);
} else {
zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
hex_digest->val[2 * ops->digest_size] = 0;
zend_string_release(digest);
- RETURN_STR(hex_digest);
+ RETURN_NEW_STR(hex_digest);
}
}
/* }}} */
@@ -542,14 +542,14 @@ PHP_FUNCTION(hash_final)
zend_list_close(Z_RES_P(zhash));
if (raw_output) {
- RETURN_STR(digest);
+ RETURN_NEW_STR(digest);
} else {
zend_string *hex_digest = zend_string_safe_alloc(digest_len, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, digest_len);
hex_digest->val[2 * digest_len] = 0;
zend_string_release(digest);
- RETURN_STR(hex_digest);
+ RETURN_NEW_STR(hex_digest);
}
}
/* }}} */
@@ -727,7 +727,7 @@ PHP_FUNCTION(hash_pbkdf2)
}
returnval->val[length] = 0;
efree(result);
- RETURN_STR(returnval);
+ RETURN_NEW_STR(returnval);
}
/* }}} */
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index e723f6e2eb..81dfd51136 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -2080,7 +2080,7 @@ PHP_FUNCTION(iconv_substr)
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
if (err == PHP_ICONV_ERR_SUCCESS && str->val[0] != '\0' && retval.s != NULL) {
- RETURN_STR(retval.s);
+ RETURN_NEW_STR(retval.s);
}
smart_str_free(&retval);
RETURN_FALSE;
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 994cf5e96a..1c5e95bf5f 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -898,7 +898,7 @@ static int handleAppendResult( int result, smart_str* loc_name)
}
/* }}} */
-#define RETURN_SMART_STR(str) smart_str_0((str)); RETURN_STR((str)->s)
+#define RETURN_SMART_STR(str) smart_str_0((str)); RETURN_NEW_STR((str)->s)
/* {{{ proto static string Locale::composeLocale($array)
* Creates a locale by combining the parts of locale-ID passed
* }}} */
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 9f6d8220ce..eec5e74acb 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1990,7 +1990,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
newstr->len = mysql_real_escape_string(mysql->mysql, newstr->val, escapestr, escapestr_len);
newstr = zend_string_realloc(newstr, newstr->len, 0);
- RETURN_STR(newstr);
+ RETURN_NEW_STR(newstr);
}
/* }}} */
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 718457de06..7f4988fb3b 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -356,7 +356,7 @@ zend_string *accel_new_interned_string(zend_string *str)
p->key->h = str->h;
p->key->len = str->len;
memcpy(p->key->val, str->val, str->len);
- ZVAL_STR(&p->val, p->key);
+ ZVAL_INTERNED_STR(&p->val, p->key);
Z_NEXT(p->val) = ZCSG(interned_strings).arHash[nIndex];
ZCSG(interned_strings).arHash[nIndex] = idx;
zend_string_release(str);
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index dff4cebf06..2b6ee3e6b4 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4008,7 +4008,7 @@ PHP_FUNCTION(openssl_pbkdf2)
if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)out_buffer->val) == 1) {
out_buffer->val[key_length] = 0;
- RETURN_STR(out_buffer);
+ RETURN_NEW_STR(out_buffer);
} else {
zend_string_release(out_buffer);
RETURN_FALSE;
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 27440bb490..6e769e06f0 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1780,7 +1780,7 @@ static PHP_FUNCTION(preg_quote)
/* Reallocate string and return it */
out_str = zend_string_realloc(out_str, q - out_str->val, 0);
- RETURN_STR(out_str);
+ RETURN_NEW_STR(out_str);
}
/* }}} */
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 2e8c6633db..4cbd218450 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -72,7 +72,7 @@
smart_str s = {0}; \
smart_str_append_unsigned(&s, oid); \
smart_str_0(&s); \
- RETURN_STR(s.s); \
+ RETURN_NEW_STR(s.s); \
} \
RETURN_LONG((zend_long)oid); \
} while(0)
@@ -2431,7 +2431,7 @@ PHP_FUNCTION(pg_field_table)
smart_str oidstr = {0};
smart_str_append_unsigned(&oidstr, oid);
smart_str_0(&oidstr);
- RETURN_STR(oidstr.s);
+ RETURN_NEW_STR(oidstr.s);
} else
#endif
RETURN_LONG((zend_long)oid);
@@ -2536,7 +2536,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
smart_str s = {0};
smart_str_append_unsigned(&s, oid);
smart_str_0(&s);
- RETURN_STR(s.s);
+ RETURN_NEW_STR(s.s);
} else
#endif
{
@@ -3515,7 +3515,7 @@ PHP_FUNCTION(pg_lo_read)
buf->len = nbytes;
buf->val[buf->len] = '\0';
- RETURN_STR(buf);
+ RETURN_NEW_STR(buf);
}
/* }}} */
@@ -4363,7 +4363,7 @@ PHP_FUNCTION(pg_escape_string)
}
to = zend_string_realloc(to, to->len, 0);
- RETURN_STR(to);
+ RETURN_NEW_STR(to);
}
/* }}} */
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 80e04046ed..4ab0559eda 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1208,7 +1208,7 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
if (fptr->type == ZEND_INTERNAL_FUNCTION) {
ZVAL_STRING(&name, ((zend_internal_arg_info*)arg_info)->name);
} else {
- ZVAL_STR(&name, zend_string_copy(arg_info->name));
+ ZVAL_STR_COPY(&name, arg_info->name);
}
} else {
ZVAL_NULL(&name);
@@ -1636,7 +1636,7 @@ ZEND_METHOD(reflection_function, __toString)
GET_REFLECTION_OBJECT_PTR(fptr);
string_init(&str);
_function_string(&str, fptr, intern->ce, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -1777,7 +1777,7 @@ ZEND_METHOD(reflection_function, getFileName)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_STR(zend_string_copy(fptr->op_array.filename));
+ RETURN_STR_COPY(fptr->op_array.filename);
}
RETURN_FALSE;
}
@@ -1831,7 +1831,7 @@ ZEND_METHOD(reflection_function, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- RETURN_STR(zend_string_copy(fptr->op_array.doc_comment));
+ RETURN_STR_COPY(fptr->op_array.doc_comment);
}
RETURN_FALSE;
}
@@ -2288,7 +2288,7 @@ ZEND_METHOD(reflection_parameter, __construct)
if (fptr->type == ZEND_INTERNAL_FUNCTION) {
ZVAL_STRING(&name, ((zend_internal_arg_info*)arg_info)[position].name);
} else {
- ZVAL_STR(&name, zend_string_copy(arg_info[position].name));
+ ZVAL_STR_COPY(&name, arg_info[position].name);
}
} else {
ZVAL_NULL(&name);
@@ -2324,7 +2324,7 @@ ZEND_METHOD(reflection_parameter, __toString)
GET_REFLECTION_OBJECT_PTR(param);
string_init(&str);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -2668,7 +2668,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
if (precv && Z_TYPE_P(RT_CONSTANT(&param->fptr->op_array, precv->op2)) == IS_CONSTANT) {
- RETURN_STR(zend_string_copy(Z_STR_P(RT_CONSTANT(&param->fptr->op_array, precv->op2))));
+ RETURN_STR_COPY(Z_STR_P(RT_CONSTANT(&param->fptr->op_array, precv->op2)));
}
}
/* }}} */
@@ -2805,7 +2805,7 @@ ZEND_METHOD(reflection_method, __toString)
GET_REFLECTION_OBJECT_PTR(mptr);
string_init(&str);
_function_string(&str, mptr, intern->ce, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -3530,7 +3530,7 @@ ZEND_METHOD(reflection_class, __toString)
GET_REFLECTION_OBJECT_PTR(ce);
string_init(&str);
_class_string(&str, ce, &intern->obj, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -3587,7 +3587,7 @@ ZEND_METHOD(reflection_class, getFileName)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_STR(zend_string_copy(ce->info.user.filename));
+ RETURN_STR_COPY(ce->info.user.filename);
}
RETURN_FALSE;
}
@@ -3641,7 +3641,7 @@ ZEND_METHOD(reflection_class, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) {
- RETURN_STR(zend_string_copy(ce->info.user.doc_comment));
+ RETURN_STR_COPY(ce->info.user.doc_comment);
}
RETURN_FALSE;
}
@@ -4883,7 +4883,7 @@ ZEND_METHOD(reflection_property, __toString)
GET_REFLECTION_OBJECT_PTR(ref);
string_init(&str);
_property_string(&str, &ref->prop, NULL, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -5134,7 +5134,7 @@ ZEND_METHOD(reflection_property, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop.doc_comment) {
- RETURN_STR(zend_string_copy(ref->prop.doc_comment));
+ RETURN_STR_COPY(ref->prop.doc_comment);
}
RETURN_FALSE;
}
@@ -5222,7 +5222,7 @@ ZEND_METHOD(reflection_extension, __toString)
GET_REFLECTION_OBJECT_PTR(module);
string_init(&str);
_extension_string(&str, module, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
@@ -5588,7 +5588,7 @@ ZEND_METHOD(reflection_zend_extension, __toString)
GET_REFLECTION_OBJECT_PTR(extension);
string_init(&str);
_zend_extension_string(&str, extension, "");
- RETURN_STR(str.buf);
+ RETURN_NEW_STR(str.buf);
}
/* }}} */
diff --git a/ext/session/session.c b/ext/session/session.c
index 8c5943a28c..25139d5ddb 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1472,7 +1472,7 @@ PHPAPI void php_session_reset_id(void) /* {{{ */
smart_str_0(&var);
if (sid) {
zend_string_release(Z_STR_P(sid));
- ZVAL_STR(sid, var.s);
+ ZVAL_NEW_STR(sid, var.s);
} else {
REGISTER_STRINGL_CONSTANT("SID", var.s->val, var.s->len, 0);
smart_str_free(&var);
@@ -1988,9 +1988,9 @@ static PHP_FUNCTION(session_id)
* see: ext/session/tests/session_id_error3.phpt */
int len = strlen(PS(id)->val);
if (UNEXPECTED(len != PS(id)->len)) {
- RETVAL_STR(zend_string_init(PS(id)->val, len, 0));
+ RETVAL_NEW_STR(zend_string_init(PS(id)->val, len, 0));
} else {
- RETVAL_STR(zend_string_copy(PS(id)));
+ RETVAL_STR_COPY(PS(id));
}
} else {
RETVAL_EMPTY_STRING();
@@ -2085,7 +2085,7 @@ static PHP_FUNCTION(session_create_id)
RETURN_FALSE;
}
smart_str_0(&id);
- RETVAL_STR(id.s);
+ RETVAL_NEW_STR(id.s);
smart_str_free(&id);
}
/* }}} */
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 2000bd24f0..751cb05c0d 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -256,7 +256,7 @@ PHP_FUNCTION(shmop_read)
return_string = zend_string_init(startaddr, bytes, 0);
- RETURN_STR(return_string);
+ RETURN_NEW_STR(return_string);
}
/* }}} */
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index d411345d44..2f580cc8d3 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -3017,7 +3017,7 @@ PHP_METHOD(SoapClient, __getLastRequest)
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
+ RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
}
@@ -3036,7 +3036,7 @@ PHP_METHOD(SoapClient, __getLastResponse)
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
+ RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
}
@@ -3055,7 +3055,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
+ RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
}
@@ -3074,7 +3074,7 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
+ RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
}
@@ -3230,7 +3230,7 @@ PHP_METHOD(SoapClient, __setLocation)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) {
- RETVAL_STR(zend_string_copy(Z_STR_P(tmp)));
+ RETVAL_STR_COPY(Z_STR_P(tmp));
} else {
RETVAL_NULL();
}
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index ad68d352c3..32172c803b 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1181,7 +1181,7 @@ PHP_FUNCTION(socket_read)
tmpbuf->len = retval;
tmpbuf->val[tmpbuf->len] = '\0' ;
- RETURN_STR(tmpbuf);
+ RETURN_NEW_STR(tmpbuf);
}
/* }}} */
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 2796ca6501..7c75511c24 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1755,7 +1755,7 @@ SPL_METHOD(Array, serialize)
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (buf.s) {
- RETURN_STR(buf.s);
+ RETURN_NEW_STR(buf.s);
}
RETURN_NULL();
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 3db7628837..68c46486e1 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1143,7 +1143,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize)
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (buf.s) {
- RETURN_STR(buf.s);
+ RETURN_NEW_STR(buf.s);
} else {
RETURN_NULL();
}
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index f0ce313eb6..3ffb8f7bec 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1056,7 +1056,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
smart_str_appendl(&str, object->prefix[5].s->val, object->prefix[5].s->len);
smart_str_0(&str);
- RETURN_STR(str.s);
+ RETURN_NEW_STR(str.s);
}
static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object *object, zval *return_value)
@@ -2128,7 +2128,7 @@ SPL_METHOD(RegexIterator, getRegex)
return;
}
- RETURN_STR(zend_string_copy(intern->u.regex.regex));
+ RETURN_STR_COPY(intern->u.regex.regex);
} /* }}} */
/* {{{ proto bool RegexIterator::getMode()
@@ -2812,7 +2812,7 @@ SPL_METHOD(CachingIterator, __toString)
return;
}
if (Z_TYPE(intern->u.caching.zstr) == IS_STRING) {
- RETURN_STR(zend_string_copy(Z_STR_P(&intern->u.caching.zstr)));
+ RETURN_STR_COPY(Z_STR_P(&intern->u.caching.zstr));
} else {
RETURN_NULL();
}
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 41687d02a3..6316431635 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -778,7 +778,7 @@ SPL_METHOD(SplObjectStorage, serialize)
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (buf.s) {
- RETURN_STR(buf.s);
+ RETURN_NEW_STR(buf.s);
} else {
RETURN_NULL();
}
diff --git a/ext/standard/array.c b/ext/standard/array.c
index e3f2a5d7cb..63bf5e95c5 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1272,7 +1272,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(zend_string_copy(str_idx));
+ RETVAL_STR_COPY(str_idx);
} else {
RETVAL_LONG(num_idx);
}
@@ -1289,7 +1289,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(zend_string_copy(str_idx));
+ RETVAL_STR_COPY(str_idx);
} else {
RETVAL_LONG(num_idx);
}
@@ -1304,7 +1304,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(zend_string_copy(str_idx));
+ RETVAL_STR_COPY(str_idx);
} else {
RETVAL_LONG(num_idx);
}
@@ -1319,7 +1319,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(zend_string_copy(str_idx));
+ RETVAL_STR_COPY(str_idx);
} else {
RETVAL_LONG(num_idx);
}
@@ -4597,7 +4597,7 @@ PHP_FUNCTION(array_rand)
/* If we are returning a single result, just do it. */
if (Z_TYPE_P(return_value) != IS_ARRAY) {
if (string_key) {
- RETURN_STR(zend_string_copy(string_key));
+ RETURN_STR_COPY(string_key);
} else {
RETURN_LONG(num_key);
}
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 46389a407b..25b77280de 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -256,7 +256,7 @@ PHP_FUNCTION(http_build_query)
smart_str_0(&formstr);
- RETURN_STR(formstr.s);
+ RETURN_NEW_STR(formstr.s);
}
/* }}} */
diff --git a/ext/standard/string.c b/ext/standard/string.c
index b55abb7fea..fbbb639dc2 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1247,7 +1247,7 @@ again:
smart_str_0(&implstr);
if (implstr.s) {
- RETURN_STR(implstr.s);
+ RETURN_NEW_STR(implstr.s);
} else {
smart_str_free(&implstr);
RETURN_EMPTY_STRING();
@@ -2442,12 +2442,12 @@ PHP_FUNCTION(substr_replace)
(argc == 4 && Z_TYPE_P(from) != Z_TYPE_P(len))
) {
php_error_docref(NULL, E_WARNING, "'from' and 'len' should be of same type - numerical or array ");
- RETURN_STR(zend_string_copy(Z_STR_P(str)));
+ RETURN_STR_COPY(Z_STR_P(str));
}
if (argc == 4 && Z_TYPE_P(from) == IS_ARRAY) {
if (zend_hash_num_elements(Z_ARRVAL_P(from)) != zend_hash_num_elements(Z_ARRVAL_P(len))) {
php_error_docref(NULL, E_WARNING, "'from' and 'len' should have the same number of elements");
- RETURN_STR(zend_string_copy(Z_STR_P(str)));
+ RETURN_STR_COPY(Z_STR_P(str));
}
}
}
@@ -2516,7 +2516,7 @@ PHP_FUNCTION(substr_replace)
RETURN_NEW_STR(result);
} else {
php_error_docref(NULL, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented");
- RETURN_STR(zend_string_copy(Z_STR_P(str)));
+ RETURN_STR_COPY(Z_STR_P(str));
}
} else { /* str is array of strings */
zend_string *str_index = NULL;
@@ -3143,10 +3143,10 @@ static void php_strtr_array(zval *return_value, zend_string *input, HashTable *p
if (result.s) {
smart_str_appendl(&result, str + old_pos, slen - old_pos);
smart_str_0(&result);
- RETVAL_STR(result.s);
+ RETVAL_NEW_STR(result.s);
} else {
smart_str_free(&result);
- RETVAL_STR(zend_string_copy(input));
+ RETVAL_STR_COPY(input);
}
if (pats == &str_hash) {
@@ -3492,7 +3492,7 @@ PHP_FUNCTION(strtr)
HashTable *pats = HASH_OF(from);
if (zend_hash_num_elements(pats) < 1) {
- RETURN_STR(zend_string_copy(str));
+ RETURN_STR_COPY(str);
} else if (zend_hash_num_elements(pats) == 1) {
zend_long num_key;
zend_string *str_key, *replace;
@@ -3507,7 +3507,7 @@ PHP_FUNCTION(strtr)
}
replace = zval_get_string(entry);
if (str_key->len < 1) {
- RETVAL_STR(zend_string_copy(str));
+ RETVAL_STR_COPY(str);
} else if (str_key->len == 1) {
RETVAL_STR(php_char_to_str_ex(str,
str_key->val[0],
@@ -4585,7 +4585,7 @@ PHP_FUNCTION(setlocale)
} else {
BG(locale_string) = zend_string_init(retval, len, 0);
zend_string_release(loc);
- RETURN_STR(zend_string_copy(BG(locale_string)));
+ RETURN_STR_COPY(BG(locale_string));
}
} else if (len == loc->len && !memcmp(loc->val, retval, len)) {
RETURN_STR(loc);
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 1c5a000c25..f8fe2cedd2 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -584,7 +584,7 @@ PHP_FUNCTION(var_export)
smart_str_0 (&buf);
if (return_output) {
- RETURN_STR(buf.s);
+ RETURN_NEW_STR(buf.s);
} else {
PHPWRITE(buf.s->val, buf.s->len);
smart_str_free(&buf);
@@ -983,7 +983,7 @@ PHP_FUNCTION(serialize)
}
if (buf.s) {
- RETURN_STR(buf.s);
+ RETURN_NEW_STR(buf.s);
} else {
RETURN_NULL();
}
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 99b7632119..371b1e95d1 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -1093,7 +1093,7 @@ PHP_FUNCTION(wddx_serialize_value)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(zend_string_copy(packet->s));
+ RETVAL_STR_COPY(packet->s);
php_wddx_destructor(packet);
}
/* }}} */
@@ -1132,7 +1132,7 @@ PHP_FUNCTION(wddx_serialize_vars)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(zend_string_copy(packet->s));
+ RETVAL_STR_COPY(packet->s);
php_wddx_destructor(packet);
}
/* }}} */
@@ -1201,7 +1201,7 @@ PHP_FUNCTION(wddx_packet_end)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(zend_string_copy(packet->s));
+ RETVAL_STR_COPY(packet->s);
zend_list_close(Z_RES_P(packet_id));
}
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 553836b8c5..1aa3412aad 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -803,7 +803,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
intern = Z_XSL_P(id);
if ((value = zend_hash_find(intern->parameter, name)) != NULL) {
convert_to_string_ex(value);
- RETURN_STR(zend_string_copy(Z_STR_P(value)));
+ RETURN_STR_COPY(Z_STR_P(value));
} else {
RETURN_FALSE;
}
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index e90ee9f979..375df46bc9 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1279,7 +1279,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
if (n > 0) {
buffer->val[n] = '\0';
buffer->len = n;
- RETURN_STR(buffer);
+ RETURN_NEW_STR(buffer);
} else {
zend_string_free(buffer);
RETURN_EMPTY_STRING()
@@ -2648,7 +2648,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
zip_fclose(zf);
buffer->val[n] = '\0';
buffer->len = n;
- RETURN_STR(buffer);
+ RETURN_NEW_STR(buffer);
}
/* }}} */