summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-09-19 15:41:01 +0400
committerDmitry Stogov <dmitry@zend.com>2014-09-19 15:41:01 +0400
commit3bc8a958c5ec647adbe409ee6411ae7ed6a3dc3b (patch)
treefb2c0e55eacad99b2dbd7e8fbe0137a861714ce7 /ext
parent3ec7c2808420ad58145d6c6b5aeb1293e81ae12b (diff)
downloadphp-git-3bc8a958c5ec647adbe409ee6411ae7ed6a3dc3b.tar.gz
Fixed useless or duplicated IS_INTERNED() checks
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c4
-rw-r--r--ext/dom/documenttype.c2
-rw-r--r--ext/fileinfo/libmagic/softmagic.c2
-rw-r--r--ext/filter/sanitizing_filters.c10
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/intl/idn/idn.c2
-rw-r--r--ext/json/json.c2
-rw-r--r--ext/mysqli/mysqli_prop.c6
-rw-r--r--ext/mysqlnd/mysqlnd.c2
-rw-r--r--ext/opcache/Optimizer/block_pass.c8
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c6
-rw-r--r--ext/opcache/zend_persist_calc.c2
-rwxr-xr-xext/openssl/openssl.c14
-rw-r--r--ext/pgsql/pgsql.c6
-rwxr-xr-xext/phar/phar_object.c6
-rw-r--r--ext/phar/zip.c4
-rw-r--r--ext/soap/php_encoding.c2
-rw-r--r--ext/soap/php_sdl.c5
-rw-r--r--ext/sockets/conversions.c6
-rw-r--r--ext/sockets/sockets.c8
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/standard/array.c2
-rw-r--r--ext/standard/string.c4
-rw-r--r--ext/standard/var.c2
24 files changed, 54 insertions, 55 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index cf3f6214a5..c23350384b 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2220,7 +2220,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
abs(utc_offset / 60),
abs((utc_offset % 60)));
- ZVAL_STR(&zv, tmpstr);
+ ZVAL_NEW_STR(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
@@ -2312,7 +2312,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /*
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
- ZVAL_STR(&zv, tmpstr);
+ ZVAL_NEW_STR(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index 1193ed44d5..b9b8db76f1 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -204,7 +204,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval TSRMLS_D
if (ret_buf.s) {
smart_str_0(&ret_buf);
- ZVAL_STR(retval, ret_buf.s);
+ ZVAL_NEW_STR(retval, ret_buf.s);
return SUCCESS;
}
}
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index 5fcc3a3c84..e626929c9e 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -1913,7 +1913,7 @@ convert_libmagic_pattern(zval *pattern, char *val, int len, int options)
t->val[j]='\0';
t->len = j;
- ZVAL_STR(pattern, t);
+ ZVAL_NEW_STR(pattern, t);
}
private int
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index ca3059cd26..a53f51bc2c 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -52,7 +52,7 @@ static void php_filter_encode_html(zval *value, const unsigned char *chars)
smart_str_0(&str);
zval_ptr_dtor(value);
- ZVAL_STR(value, str.s);
+ ZVAL_NEW_STR(value, str.s);
}
static const unsigned char hexchars[] = "0123456789ABCDEF";
@@ -105,7 +105,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
*p = '\0';
str->len = p - (unsigned char *)str->val;
zval_ptr_dtor(value);
- ZVAL_STR(value, str);
+ ZVAL_NEW_STR(value, str);
}
static void php_filter_strip(zval *value, zend_long flags)
@@ -135,7 +135,7 @@ static void php_filter_strip(zval *value, zend_long flags)
buf->val[c] = '\0';
buf->len = c;
zval_ptr_dtor(value);
- ZVAL_STR(value, buf);
+ ZVAL_NEW_STR(value, buf);
}
/* }}} */
@@ -174,7 +174,7 @@ static void filter_map_apply(zval *value, filter_map *map)
buf->val[c] = '\0';
buf->len = c;
zval_ptr_dtor(value);
- ZVAL_STR(value, buf);
+ ZVAL_NEW_STR(value, buf);
}
/* }}} */
@@ -184,7 +184,7 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
size_t new_len;
unsigned char enc[256] = {0};
- if (IS_INTERNED(Z_STR_P(value))) {
+ if (!Z_REFCOUNTED_P(value)) {
ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRLEN_P(value));
}
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 2d4b5fc8c1..25c06398b7 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -790,7 +790,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base) /* {{{ */
str->val[str->len] = '\0';
}
- ZVAL_STR(result, str);
+ ZVAL_NEW_STR(result, str);
}
/* }}} */
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 99e484c17e..7de9dacdd0 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -184,7 +184,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, return_value);
} else {
zval zv;
- ZVAL_STR(&zv, buffer);
+ ZVAL_NEW_STR(&zv, buffer);
buffer_used = 1;
add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, &zv);
}
diff --git a/ext/json/json.c b/ext/json/json.c
index 24324bbe99..2b35c00041 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -789,7 +789,7 @@ static PHP_FUNCTION(json_encode)
ZVAL_FALSE(return_value);
} else {
smart_str_0(&buf); /* copy? */
- ZVAL_STR(return_value, buf.s);
+ ZVAL_NEW_STR(return_value, buf.s);
}
}
/* }}} */
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index c1fa0a17d6..16a1cde175 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -84,7 +84,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \
if (l < ZEND_LONG_MAX) {\
ZVAL_LONG(retval, (zend_long) l);\
} else { \
- ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
+ ZVAL_NEW_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
} \
}\
return retval;\
@@ -170,7 +170,7 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (rc < ZEND_LONG_MAX) {
ZVAL_LONG(retval, (zend_long) rc);
} else {
- ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
}
return retval;
@@ -357,7 +357,7 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (rc < ZEND_LONG_MAX) {
ZVAL_LONG(retval, (zend_long) rc);
} else {
- ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
}
return retval;
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 20972f64be..a6b8326273 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -2496,7 +2496,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons
DBG_INF_FMT("Adding [%s][%s]", key, value);
{
zval attrz;
- ZVAL_STR(&attrz, zend_string_init(value, strlen(value), 1));
+ ZVAL_NEW_STR(&attrz, zend_string_init(value, strlen(value), 1));
zend_hash_str_update(conn->options->connect_attr, key, strlen(key), &attrz);
}
break;
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 42fc06853f..1f873912b4 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -911,7 +911,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
}
old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
- if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(last_op)))) {
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
zend_string *tmp = zend_string_alloc(l, 0);
memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
@@ -923,7 +923,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
zval_dtor(&ZEND_OP1_LITERAL(opline));
Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(opline)))) {
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
@@ -955,7 +955,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
COPY_NODE(opline->op1, src->op1);
old_len = Z_STRLEN(ZEND_OP2_LITERAL(src));
l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline));
- if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(src)))) {
+ if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(src))) {
zend_string *tmp = zend_string_alloc(l, 0);
memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len);
Z_STR(ZEND_OP2_LITERAL(last_op)) = tmp;
@@ -967,7 +967,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0';
zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline)));
Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(opline)))) {
+ if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_NULL(&ZEND_OP2_LITERAL(src));
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index e04b1ec7db..5dbb48237d 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -232,14 +232,14 @@ static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC)
if (IS_INTERNED(str)) {
ret = str;
- } else if (zend_string_refcount(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) {
+ } else if (GC_REFCOUNT(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) {
ret = zend_string_dup(str, 0);
GC_FLAGS(ret) = GC_FLAGS(str);
- if (zend_string_refcount(str) > 1) {
+ if (GC_REFCOUNT(str) > 1) {
accel_xlat_set(str, ret);
}
} else {
- zend_string_addref(ret);
+ GC_REFCOUNT(ret)++;
}
return ret;
}
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index 76d1b043b0..d2de94f05c 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -120,7 +120,7 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC)
case IS_CONSTANT:
flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
ADD_INTERNED_STRING(Z_STR_P(z), 0);
- if (IS_INTERNED(Z_STR_P(z))) {
+ if (!Z_REFCOUNTED_P(z)) {
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
Z_GC_FLAGS_P(z) |= flags;
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index f2219dcd1e..e6b1524c80 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4386,7 +4386,7 @@ PHP_FUNCTION(openssl_private_encrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4451,7 +4451,7 @@ PHP_FUNCTION(openssl_private_decrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4509,7 +4509,7 @@ PHP_FUNCTION(openssl_public_encrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4576,7 +4576,7 @@ PHP_FUNCTION(openssl_public_decrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4660,7 +4660,7 @@ PHP_FUNCTION(openssl_sign)
zval_dtor(signature);
sigbuf->val[siglen] = '\0';
sigbuf->len = siglen;
- ZVAL_STR(signature, sigbuf);
+ ZVAL_NEW_STR(signature, sigbuf);
RETVAL_TRUE;
} else {
efree(sigbuf);
@@ -4812,7 +4812,7 @@ PHP_FUNCTION(openssl_seal)
if (len1 + len2 > 0) {
zval_dtor(sealdata);
buf[len1 + len2] = '\0';
- ZVAL_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0));
+ ZVAL_NEW_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0));
efree(buf);
zval_dtor(ekeys);
@@ -4903,7 +4903,7 @@ PHP_FUNCTION(openssl_open)
} else {
zval_dtor(opendata);
buf[len1 + len2] = '\0';
- ZVAL_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0));
+ ZVAL_NEW_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0));
efree(buf);
RETVAL_TRUE;
}
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index e06ca1c313..37b5da6ec4 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -5701,7 +5701,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
if (should_free) {
zval_ptr_dtor(src);
}
- ZVAL_STR(src, str.s);
+ ZVAL_NEW_STR(src, str.s);
return SUCCESS;
}
@@ -5971,7 +5971,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
/* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */
str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
str = zend_string_realloc(str, str->len, 0);
- ZVAL_STR(&new_val, str);
+ ZVAL_NEW_STR(&new_val, str);
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
break;
@@ -6268,7 +6268,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val));
smart_str_0(&s);
zval_ptr_dtor(&new_val);
- ZVAL_STR(&new_val, s.s);
+ ZVAL_NEW_STR(&new_val, s.s);
}
break;
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index c446dac7df..f82b825631 100755
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -87,7 +87,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
zend_string *str = strpprintf(4096, "phar://%s%s", fname, entry);
ZVAL_STR(&temp, Z_STR_P(stuff));
- ZVAL_STR(stuff, str);
+ ZVAL_NEW_STR(stuff, str);
zend_hash_str_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED")-1, &temp);
}
@@ -134,7 +134,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
zend_string *str = strpprintf(4096, "phar://%s%s", fname, entry);
ZVAL_STR(&temp, Z_STR_P(stuff));
- ZVAL_STR(stuff, str);
+ ZVAL_NEW_STR(stuff, str);
zend_hash_str_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME")-1, &temp);
}
@@ -3551,7 +3551,7 @@ PHP_METHOD(Phar, offsetGet)
}
sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
- ZVAL_STR(&zfname, sfname);
+ ZVAL_NEW_STR(&zfname, sfname);
spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname TSRMLS_CC);
zval_ptr_dtor(&zfname);
}
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index a314498813..4fe0bf05c8 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -241,7 +241,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
mydata->metadata_len = 0;
/* if not valid serialized data, it is a regular string */
- ZVAL_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
+ ZVAL_NEW_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
}
} else {
ZVAL_UNDEF(&mydata->metadata);
@@ -529,7 +529,7 @@ foundit:
entry.metadata_len = 0;
/* if not valid serialized data, it is a regular string */
- ZVAL_STR(&entry.metadata, zend_string_init(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent));
+ ZVAL_NEW_STR(&entry.metadata, zend_string_init(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent));
}
} else {
ZVAL_UNDEF(&entry.metadata);
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 8de045ae80..f116342bb8 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -813,7 +813,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML
}
}
str->val[str->len] = '\0';
- ZVAL_STR(ret, str);
+ ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
}
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 587695b943..c7e52dfb8c 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -292,7 +292,7 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
zval new_header;
rest += 2;
- ZVAL_STR(&new_header, zend_string_alloc(Z_STRLEN_P(header) - (rest - s), 0));
+ ZVAL_NEW_STR(&new_header, zend_string_alloc(Z_STRLEN_P(header) - (rest - s), 0));
memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header));
memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1);
ZVAL_COPY(&ctx->old_header, header);
@@ -3250,8 +3250,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC)
smart_str_appends(&proxy,Z_STRVAL(str_port));
smart_str_0(&proxy);
zval_dtor(&str_port);
- ZVAL_STR(&str_proxy, zend_string_copy(proxy.s));
- smart_str_free(&proxy);
+ ZVAL_NEW_STR(&str_proxy, proxy.s);
if (!context) {
context = php_stream_context_alloc(TSRMLS_C);
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index febfa9abd8..d9221e52f5 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -562,7 +562,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx)
zend_string *str = zend_string_alloc(size - 1, 0);
memset(str->val, '\0', size);
- ZVAL_STR(zv, str);
+ ZVAL_NEW_STR(zv, str);
if (inet_ntop(AF_INET, addr, Z_STRVAL_P(zv), size) == NULL) {
do_to_zval_err(ctx, "could not convert IPv4 address to string "
@@ -614,7 +614,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx)
memset(str->val, '\0', size);
- ZVAL_STR(zv, str);
+ ZVAL_NEW_STR(zv, str);
if (inet_ntop(AF_INET6, addr, Z_STRVAL_P(zv), size) == NULL) {
do_to_zval_err(ctx, "could not convert IPv6 address to string "
@@ -1212,7 +1212,7 @@ static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx)
memcpy(buf->val, msghdr->msg_iov[i].iov_base, buf->len);
buf->val[buf->len] = '\0';
- ZVAL_STR(&elem, buf);
+ ZVAL_NEW_STR(&elem, buf);
add_next_index_zval(zv, &elem);
bytes_left -= len;
}
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 0da81e74f5..4271588823 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1586,7 +1586,7 @@ PHP_FUNCTION(socket_recv)
/* Rebuild buffer zval */
zval_dtor(buf);
- ZVAL_STR(buf, recv_buf);
+ ZVAL_NEW_STR(buf, recv_buf);
}
if (retval == -1) {
@@ -1673,7 +1673,7 @@ PHP_FUNCTION(socket_recvfrom)
zval_dtor(arg2);
zval_dtor(arg5);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, s_un.sun_path);
break;
@@ -1703,7 +1703,7 @@ PHP_FUNCTION(socket_recvfrom)
address = inet_ntoa(sin.sin_addr);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, address ? address : "0.0.0.0");
ZVAL_LONG(arg6, ntohs(sin.sin_port));
break;
@@ -1735,7 +1735,7 @@ PHP_FUNCTION(socket_recvfrom)
memset(addr6, 0, INET6_ADDRSTRLEN);
inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, addr6[0] ? addr6 : "::");
ZVAL_LONG(arg6, ntohs(sin6.sin6_port));
break;
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 293be0b0dd..2d92044be7 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2916,7 +2916,7 @@ SPL_METHOD(SplFileObject, fread)
RETURN_FALSE;
}
- ZVAL_STR(return_value, zend_string_alloc(length, 0));
+ ZVAL_NEW_STR(return_value, zend_string_alloc(length, 0));
Z_STRLEN_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length);
/* needed because recv/read/gzread doesnt put a null at the end*/
diff --git a/ext/standard/array.c b/ext/standard/array.c
index a417925528..ecb8603d2c 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1826,7 +1826,7 @@ static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
for (j = 0; j < n_elems; j++) {
p = hash->arData + j;
- if (p->key && !IS_INTERNED(p->key)) {
+ if (p->key) {
zend_string_release(p->key);
}
p->h = j;
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c01259b85e..fec8b70934 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4159,7 +4159,7 @@ PHP_FUNCTION(strip_tags)
if (allow != NULL) {
convert_to_string_ex(allow);
// TODO: reimplement to avoid reallocation ???
- if (IS_INTERNED(Z_STR_P(allow))) {
+ if (!Z_REFCOUNTED_P(allow)) {
allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow));
allowed_tags_len = Z_STRLEN_P(allow);
} else {
@@ -4172,7 +4172,7 @@ PHP_FUNCTION(strip_tags)
buf->len = php_strip_tags_ex(buf->val, str->len, NULL, allowed_tags, allowed_tags_len, 0);
// TODO: reimplement to avoid reallocation ???
- if (allow && IS_INTERNED(Z_STR_P(allow))) {
+ if (allow && !Z_REFCOUNTED_P(allow)) {
efree(allowed_tags);
}
RETURN_STR(buf);
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 664198ad97..aa1e576354 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -299,7 +299,7 @@ again:
case IS_STRING:
php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
- php_printf("\" refcount(%u)\n", IS_INTERNED(Z_STR_P(struc)) ? 1 : Z_REFCOUNT_P(struc));
+ php_printf("\" refcount(%u)\n", Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) : 1);
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);