summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/com_dotnet/com_com.c3
-rw-r--r--ext/ctype/ctype.c6
-rw-r--r--ext/date/php_date.c15
-rw-r--r--ext/dba/dba_db1.c3
-rw-r--r--ext/dba/dba_db2.c3
-rw-r--r--ext/dba/dba_db3.c3
-rw-r--r--ext/dba/dba_db4.c3
-rw-r--r--ext/dba/dba_dbm.c3
-rw-r--r--ext/dba/dba_gdbm.c3
-rw-r--r--ext/dba/dba_lmdb.c3
-rw-r--r--ext/dba/dba_ndbm.c3
-rw-r--r--ext/iconv/iconv.c2
-rw-r--r--ext/imap/php_imap.c24
-rw-r--r--ext/intl/dateformat/dateformat_parse.c14
-rw-r--r--ext/intl/formatter/formatter_attr.c6
-rw-r--r--ext/intl/formatter/formatter_parse.c6
-rw-r--r--ext/intl/transliterator/transliterator_class.c5
-rw-r--r--ext/ldap/ldap.c21
-rw-r--r--ext/mbstring/mbstring.c3
-rw-r--r--ext/mysqli/mysqli.c6
-rw-r--r--ext/mysqli/mysqli_warning.c3
-rw-r--r--ext/openssl/xp_ssl.c17
-rw-r--r--ext/pdo_firebird/firebird_statement.c7
-rw-r--r--ext/pgsql/pgsql.c3
-rw-r--r--ext/posix/posix.c6
-rw-r--r--ext/simplexml/simplexml.c3
-rw-r--r--ext/snmp/snmp.c68
-rw-r--r--ext/soap/php_sdl.c7
-rw-r--r--ext/sockets/sockets.c17
-rw-r--r--ext/standard/info.c18
-rw-r--r--ext/standard/php_fopen_wrapper.c3
-rw-r--r--ext/standard/scanf.c4
-rw-r--r--ext/standard/string.c2
-rw-r--r--ext/sysvmsg/sysvmsg.c12
-rw-r--r--ext/tidy/tidy.c34
-rw-r--r--ext/xml/xml.c9
-rw-r--r--ext/xmlreader/php_xmlreader.c12
-rw-r--r--ext/zip/php_zip.c9
38 files changed, 116 insertions, 253 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 4b93a47dd3..c508b75573 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -116,8 +116,7 @@ PHP_FUNCTION(com_create_instance)
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
"Flags", sizeof("Flags")-1))) {
- convert_to_long_ex(tmp);
- ctx = (CLSCTX)Z_LVAL_P(tmp);
+ ctx = (CLSCTX)zval_get_long(tmp);
}
}
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index 9b8abe6b06..9dee67878c 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -153,11 +153,9 @@ static PHP_MINFO_FUNCTION(ctype)
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
RETURN_BOOL(iswhat((int)Z_LVAL_P(c) + 256)); \
} \
- tmp = *c; \
- zval_copy_ctor(&tmp); \
- convert_to_string(&tmp); \
+ ZVAL_STR(&tmp, zval_get_string_func(c)); \
} else { \
- tmp = *c; \
+ ZVAL_COPY_VALUE(&tmp, c); \
} \
if (Z_TYPE(tmp) == IS_STRING) { \
char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 9d6f698db6..10c4db9a5b 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2035,8 +2035,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
int retval = 0;
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -4124,9 +4123,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
double fvalue = -1;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -4194,9 +4191,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
zval tmp_member;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -4245,9 +4240,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int
zval tmp_member, *ret;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c
index dd08041568..6cb374f848 100644
--- a/ext/dba/dba_db1.c
+++ b/ext/dba/dba_db1.c
@@ -51,8 +51,7 @@ DBA_OPEN_FUNC(db1)
int filemode = 0644;
if (info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
gmode = 0;
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
index a688809998..43ce928b02 100644
--- a/ext/dba/dba_db2.c
+++ b/ext/dba/dba_db2.c
@@ -72,8 +72,7 @@ DBA_OPEN_FUNC(db2)
}
if (info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index 90db5a0a06..5a893f88b5 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.c
@@ -84,8 +84,7 @@ DBA_OPEN_FUNC(db3)
}
if (info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
#ifdef DB_FCNTL_LOCKING
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index 344515d820..a9d751269b 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -117,8 +117,7 @@ DBA_OPEN_FUNC(db4)
}
if (info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
if ((err=db_create(&dbp, NULL, 0)) == 0) {
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
index 3428b74905..ace1e32658 100644
--- a/ext/dba/dba_dbm.c
+++ b/ext/dba/dba_dbm.c
@@ -60,8 +60,7 @@ DBA_OPEN_FUNC(dbm)
int filemode = 0644;
if(info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
if(info->mode == DBA_TRUNC) {
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index a45613426d..c21d3e0063 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.c
@@ -54,8 +54,7 @@ DBA_OPEN_FUNC(gdbm)
return FAILURE; /* not possible */
if(info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
diff --git a/ext/dba/dba_lmdb.c b/ext/dba/dba_lmdb.c
index 6f7d2da21b..de21e0239a 100644
--- a/ext/dba/dba_lmdb.c
+++ b/ext/dba/dba_lmdb.c
@@ -47,8 +47,7 @@ DBA_OPEN_FUNC(lmdb)
int rc, mode = 0644, flags = MDB_NOSUBDIR;
if(info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- mode = Z_LVAL(info->argv[0]);
+ mode = zval_get_long(&info->argv[0]);
/* TODO implement handling of the additional flags. */
}
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
index 3b3f16719a..474d3882df 100644
--- a/ext/dba/dba_ndbm.c
+++ b/ext/dba/dba_ndbm.c
@@ -59,8 +59,7 @@ DBA_OPEN_FUNC(ndbm)
}
if(info->argc > 0) {
- convert_to_long_ex(&info->argv[0]);
- filemode = Z_LVAL(info->argv[0]);
+ filemode = zval_get_long(&info->argv[0]);
}
dbf = dbm_open(info->path, gmode, filemode);
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index ad1dd1e443..c8aa7fcd12 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -2271,7 +2271,7 @@ PHP_FUNCTION(iconv_mime_encode)
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) {
if (Z_TYPE_P(pzval) != IS_STRING) {
- tmp_str = zval_get_string(pzval);
+ tmp_str = zval_get_string_func(pzval);
lfchars = ZSTR_VAL(tmp_str);
} else {
lfchars = Z_STRVAL_P(pzval);
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 17456e3df7..1dd4878d2f 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -3609,12 +3609,10 @@ PHP_FUNCTION(imap_mail_compose)
topbod = bod;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->type = (short) Z_LVAL_P(pvalue);
+ bod->type = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_P(pvalue);
+ bod->encoding = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3682,12 +3680,10 @@ PHP_FUNCTION(imap_mail_compose)
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_P(pvalue);
+ bod->size.lines = zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_P(pvalue);
+ bod->size.bytes = zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3696,8 +3692,7 @@ PHP_FUNCTION(imap_mail_compose)
} else if (Z_TYPE_P(data) == IS_ARRAY) {
short type = -1;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- type = (short) Z_LVAL_P(pvalue);
+ type = (short) zval_get_long(pvalue);
}
if (!toppart) {
@@ -3716,8 +3711,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_P(pvalue);
+ bod->encoding = (short) zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3786,12 +3780,10 @@ PHP_FUNCTION(imap_mail_compose)
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_P(pvalue);
+ bod->size.lines = zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_P(pvalue);
+ bod->size.bytes = zval_get_long(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c
index bdf9a1e32c..b109946844 100644
--- a/ext/intl/dateformat/dateformat_parse.c
+++ b/ext/intl/dateformat/dateformat_parse.c
@@ -130,6 +130,7 @@ PHP_FUNCTION(datefmt_parse)
char* text_to_parse = NULL;
size_t text_len =0;
zval* z_parse_pos = NULL;
+ zend_long long_parse_pos;
int32_t parse_pos = -1;
DATE_FORMAT_METHOD_INIT_VARS;
@@ -146,13 +147,13 @@ PHP_FUNCTION(datefmt_parse)
if (z_parse_pos) {
ZVAL_DEREF(z_parse_pos);
- convert_to_long(z_parse_pos);
- if (ZEND_LONG_INT_OVFL(Z_LVAL_P(z_parse_pos))) {
+ long_parse_pos = zval_get_long(z_parse_pos);
+ if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.", 0);
RETURN_FALSE;
}
- parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
+ parse_pos = (int32_t)long_parse_pos;
if((size_t)parse_pos > text_len) {
RETURN_FALSE;
}
@@ -174,6 +175,7 @@ PHP_FUNCTION(datefmt_localtime)
char* text_to_parse = NULL;
size_t text_len =0;
zval* z_parse_pos = NULL;
+ zend_long long_parse_pos;
int32_t parse_pos = -1;
DATE_FORMAT_METHOD_INIT_VARS;
@@ -190,13 +192,13 @@ PHP_FUNCTION(datefmt_localtime)
if (z_parse_pos) {
ZVAL_DEREF(z_parse_pos);
- convert_to_long(z_parse_pos);
- if (ZEND_LONG_INT_OVFL(Z_LVAL_P(z_parse_pos))) {
+ long_parse_pos = zval_get_long(z_parse_pos);
+ if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.", 0);
RETURN_FALSE;
}
- parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
+ parse_pos = (int32_t)long_parse_pos;
if((size_t)parse_pos > text_len) {
RETURN_FALSE;
}
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index f5efda6119..f6aa8d0d7e 100644
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -182,12 +182,10 @@ PHP_FUNCTION( numfmt_set_attribute )
case UNUM_MIN_SIGNIFICANT_DIGITS:
case UNUM_MAX_SIGNIFICANT_DIGITS:
case UNUM_LENIENT_PARSE:
- convert_to_long_ex(value);
- unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value));
+ unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, zval_get_long(value));
break;
case UNUM_ROUNDING_INCREMENT:
- convert_to_double_ex(value);
- unum_setDoubleAttribute(FORMATTER_OBJECT(nfo), attribute, Z_DVAL_P(value));
+ unum_setDoubleAttribute(FORMATTER_OBJECT(nfo), attribute, zval_get_double(value));
break;
default:
INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index 37b28ae558..af0e4c8a64 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -69,8 +69,7 @@ PHP_FUNCTION( numfmt_parse )
if(zposition) {
ZVAL_DEREF(zposition);
- convert_to_long(zposition);
- position = (int32_t)Z_LVAL_P( zposition );
+ position = (int32_t)zval_get_long( zposition );
position_p = &position;
}
@@ -157,8 +156,7 @@ PHP_FUNCTION( numfmt_parse_currency )
if(zposition) {
ZVAL_DEREF(zposition);
- convert_to_long(zposition);
- position = (int32_t)Z_LVAL_P( zposition );
+ position = (int32_t)zval_get_long( zposition );
position_p = &position;
}
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index ca174e2e70..1b0b99be97 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -194,9 +194,8 @@ err:
zval tmp_member; \
if( Z_TYPE_P( member ) != IS_STRING ) \
{ \
- tmp_member = *member; \
- zval_copy_ctor( &tmp_member ); \
- convert_to_string( &tmp_member ); \
+ ZVAL_STR(&tmp_member, \
+ zval_get_string_func(member)); \
member = &tmp_member; \
cache_slot = NULL; \
}
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 1b19e0599a..bd7e8ac64c 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -315,8 +315,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
int pagesize = 1;
struct berval cookie = { 0, NULL };
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "size", sizeof("size") - 1)) != NULL) {
- convert_to_long_ex(tmp);
- pagesize = Z_LVAL_P(tmp);
+ pagesize = zval_get_long(tmp);
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "cookie", sizeof("cookie") - 1)) != NULL) {
convert_to_string_ex(tmp);
@@ -483,8 +482,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
struct berval context;
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "before", sizeof("before") - 1)) != NULL) {
- convert_to_long_ex(tmp);
- vlvInfo.ldvlv_before_count = Z_LVAL_P(tmp);
+ vlvInfo.ldvlv_before_count = zval_get_long(tmp);
} else {
rc = -1;
php_error_docref(NULL, E_WARNING, "Before key missing from array value for VLV control");
@@ -492,8 +490,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "after", sizeof("after") - 1)) != NULL) {
- convert_to_long_ex(tmp);
- vlvInfo.ldvlv_after_count = Z_LVAL_P(tmp);
+ vlvInfo.ldvlv_after_count = zval_get_long(tmp);
} else {
rc = -1;
php_error_docref(NULL, E_WARNING, "After key missing from array value for VLV control");
@@ -507,11 +504,9 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
vlvInfo.ldvlv_attrvalue = &attrValue;
} else if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "offset", sizeof("offset") - 1)) != NULL) {
vlvInfo.ldvlv_attrvalue = NULL;
- convert_to_long_ex(tmp);
- vlvInfo.ldvlv_offset = Z_LVAL_P(tmp);
+ vlvInfo.ldvlv_offset = zval_get_long(tmp);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "count", sizeof("count") - 1)) != NULL) {
- convert_to_long_ex(tmp);
- vlvInfo.ldvlv_count = Z_LVAL_P(tmp);
+ vlvInfo.ldvlv_count = zval_get_long(tmp);
} else {
rc = -1;
php_error_docref(NULL, E_WARNING, "Count key missing from array value for VLV control");
@@ -3720,8 +3715,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
ZVAL_COPY_VALUE(&cb_args[0], cb_link);
ZVAL_STRING(&cb_args[1], url);
if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL) == SUCCESS && !Z_ISUNDEF(cb_retval)) {
- convert_to_long_ex(&cb_retval);
- retval = Z_LVAL(cb_retval);
+ retval = zval_get_long(&cb_retval);
zval_ptr_dtor(&cb_retval);
} else {
php_error_docref(NULL, E_WARNING, "rebind_proc PHP callback failed");
@@ -4378,8 +4372,7 @@ PHP_FUNCTION(ldap_exop_refresh)
ldn.bv_val = Z_STRVAL_P(dn);
ldn.bv_len = Z_STRLEN_P(dn);
- convert_to_long_ex(ttl);
- lttl = (ber_int_t)Z_LVAL_P(ttl);
+ lttl = (ber_int_t)zval_get_long(ttl);
rc = ldap_refresh_s(ld->link, &ldn, lttl, &newttl, NULL, NULL);
if (rc != LDAP_SUCCESS ) {
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index fbd7c9e664..e9b6d4a32c 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -3932,8 +3932,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
mapelm = convmap;
mapsize = 0;
ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
- convert_to_long_ex(hash_entry);
- *mapelm++ = Z_LVAL_P(hash_entry);
+ *mapelm++ = zval_get_long(hash_entry);
mapsize++;
} ZEND_HASH_FOREACH_END();
}
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index c8d8bd44f5..97660f0022 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -307,8 +307,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
obj = Z_MYSQLI_P(object);
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
@@ -342,8 +341,7 @@ void mysqli_write_property(zval *object, zval *member, zval *value, void **cache
mysqli_prop_handler *hnd = NULL;
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 19a51735ad..a3b6b76d75 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -144,8 +144,7 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql)
/* 1. Here comes the error no */
entry = zend_hash_get_current_data(Z_ARRVAL(row));
- convert_to_long_ex(entry);
- errno = Z_LVAL_P(entry);
+ errno = zval_get_long(entry);
zend_hash_move_forward(Z_ARRVAL(row));
/* 2. Here comes the reason */
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index ed14a46888..9f7773039f 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -88,7 +88,7 @@
#define GET_VER_OPT_STRING(name, str) \
if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_P(val); }
#define GET_VER_OPT_LONG(name, num) \
- if (GET_VER_OPT(name)) { convert_to_long_ex(val); num = Z_LVAL_P(val); }
+ if (GET_VER_OPT(name)) { num = zval_get_long(val); }
/* Used for peer verification in windows */
#define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) \
@@ -1109,8 +1109,7 @@ static void php_openssl_init_server_reneg_limit(php_stream *stream, php_openssl_
if (PHP_STREAM_CONTEXT(stream) &&
NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit"))
) {
- convert_to_long(val);
- limit = Z_LVAL_P(val);
+ limit = zval_get_long(val);
}
/* No renegotiation rate-limiting */
@@ -1121,8 +1120,7 @@ static void php_openssl_init_server_reneg_limit(php_stream *stream, php_openssl_
if (PHP_STREAM_CONTEXT(stream) &&
NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_window"))
) {
- convert_to_long(val);
- window = Z_LVAL_P(val);
+ window = zval_get_long(val);
}
sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t),
@@ -1618,11 +1616,11 @@ int php_openssl_setup_crypto(php_stream *stream,
if (GET_VER_OPT("security_level")) {
#ifdef HAVE_SEC_LEVEL
- convert_to_long(val);
- if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > 5) {
+ zend_long lval = zval_get_long(val);
+ if (lval < 0 || lval > 5) {
php_error_docref(NULL, E_WARNING, "Security level must be between 0 and 5");
}
- SSL_CTX_set_security_level(sslsock->ctx, Z_LVAL_P(val));
+ SSL_CTX_set_security_level(sslsock->ctx, lval);
#else
php_error_docref(NULL, E_WARNING,
"security_level is not supported by the linked OpenSSL library "
@@ -2557,8 +2555,7 @@ static zend_long php_openssl_get_crypto_method(
zval *val;
if (ctx && (val = php_stream_context_get_option(ctx, "ssl", "crypto_method")) != NULL) {
- convert_to_long_ex(val);
- crypto_method = (zend_long)Z_LVAL_P(val);
+ crypto_method = zval_get_long(val);
crypto_method |= STREAM_CRYPTO_IS_CLIENT;
}
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 3feeedf39f..1061785a53 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -458,11 +458,10 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param)
return 0;
}
- data = *param;
-
if (Z_TYPE_P(param) != IS_STRING) {
- zval_copy_ctor(&data);
- convert_to_string(&data);
+ ZVAL_STR(&data, zval_get_string_func(param));
+ } else {
+ ZVAL_COPY_VALUE(&data, param);
}
for (rem_cnt = Z_STRLEN(data); rem_cnt > 0; rem_cnt -= chunk_size) {
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 5ff7ed471d..288b5aa44d 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1335,8 +1335,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
connstring = Z_STRVAL(args[0]);
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */
connstring = Z_STRVAL(args[0]);
- convert_to_long_ex(&args[1]);
- connect_type = (int)Z_LVAL(args[1]);
+ connect_type = (int)zval_get_long(&args[1]);
} else {
host = Z_STRVAL(args[0]);
port = Z_STRVAL(args[1]);
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index bb23a5bc29..516b8f2318 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -805,8 +805,7 @@ PHP_FUNCTION(posix_ttyname)
}
break;
default:
- convert_to_long_ex(z_fd);
- fd = Z_LVAL_P(z_fd);
+ fd = zval_get_long(z_fd);
}
#if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX)
buflen = sysconf(_SC_TTY_NAME_MAX);
@@ -850,8 +849,7 @@ PHP_FUNCTION(posix_isatty)
}
break;
default:
- convert_to_long_ex(z_fd);
- fd = Z_LVAL_P(z_fd);
+ fd = zval_get_long(z_fd);
}
if (isatty(fd)) {
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index ece2d0020c..6a9cf81641 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -522,9 +522,8 @@ long_dim:
case IS_DOUBLE:
case IS_NULL:
if (Z_TYPE_P(value) != IS_STRING) {
- ZVAL_COPY(&zval_copy, value);
+ ZVAL_STR(&zval_copy, zval_get_string_func(value));
value = &zval_copy;
- convert_to_string(value);
new_value = 1;
}
break;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index d180a73a46..9ba0223422 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1924,8 +1924,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
obj = Z_SNMP_P(object);
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
@@ -1960,8 +1959,7 @@ void php_snmp_write_property(zval *object, zval *member, zval *value, void **cac
php_snmp_prop_handler *hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
@@ -2130,29 +2128,20 @@ static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval)
/* {{{ */
static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval)
{
- zval ztmp;
int ret = SUCCESS;
+ zend_long lval;
if (Z_TYPE_P(newval) == IS_NULL) {
snmp_object->max_oids = 0;
return ret;
}
- if (Z_TYPE_P(newval) != IS_LONG) {
- ztmp = *newval;
- zval_copy_ctor(&ztmp);
- convert_to_long(&ztmp);
- newval = &ztmp;
- }
+ lval = zval_get_long(newval);
- if (Z_LVAL_P(newval) > 0) {
- snmp_object->max_oids = Z_LVAL_P(newval);
+ if (lval > 0) {
+ snmp_object->max_oids = lval;
} else {
- php_error_docref(NULL, E_WARNING, "max_oids should be positive integer or NULL, got " ZEND_LONG_FMT, Z_LVAL_P(newval));
- }
-
- if (newval == &ztmp) {
- zval_dtor(newval);
+ php_error_docref(NULL, E_WARNING, "max_oids should be positive integer or NULL, got " ZEND_LONG_FMT, lval);
}
return ret;
@@ -2164,25 +2153,15 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new
{
zval ztmp;
int ret = SUCCESS;
+ zend_long lval = zval_get_long(newval);
- if (Z_TYPE_P(newval) != IS_LONG) {
- ztmp = *newval;
- zval_copy_ctor(&ztmp);
- convert_to_long(&ztmp);
- newval = &ztmp;
- }
-
- if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
- snmp_object->valueretrieval = Z_LVAL_P(newval);
+ if (lval >= 0 && lval <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
+ snmp_object->valueretrieval = lval;
} else {
php_error_docref(NULL, E_WARNING, "Unknown SNMP value retrieval method '" ZEND_LONG_FMT "'", Z_LVAL_P(newval));
ret = FAILURE;
}
- if (newval == &ztmp) {
- zval_dtor(newval);
- }
-
return ret;
}
/* }}} */
@@ -2207,32 +2186,24 @@ PHP_SNMP_BOOL_PROPERTY_WRITER_FUNCTION(oid_increasing_check)
/* {{{ */
static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *newval)
{
- zval ztmp;
int ret = SUCCESS;
- if (Z_TYPE_P(newval) != IS_LONG) {
- ZVAL_COPY(&ztmp, newval);
- convert_to_long(&ztmp);
- newval = &ztmp;
- }
+ zend_long lval = zval_get_long(newval);
- switch(Z_LVAL_P(newval)) {
+ switch(lval) {
case NETSNMP_OID_OUTPUT_SUFFIX:
case NETSNMP_OID_OUTPUT_MODULE:
case NETSNMP_OID_OUTPUT_FULL:
case NETSNMP_OID_OUTPUT_NUMERIC:
case NETSNMP_OID_OUTPUT_UCD:
case NETSNMP_OID_OUTPUT_NONE:
- snmp_object->oid_output_format = Z_LVAL_P(newval);
+ snmp_object->oid_output_format = lval;
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown SNMP output print format '" ZEND_LONG_FMT "'", Z_LVAL_P(newval));
+ php_error_docref(NULL, E_WARNING, "Unknown SNMP output print format '" ZEND_LONG_FMT "'", lval);
ret = FAILURE;
break;
}
- if (newval == &ztmp) {
- zval_ptr_dtor(newval);
- }
return ret;
}
/* }}} */
@@ -2240,19 +2211,10 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *
/* {{{ */
static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval *newval)
{
- zval ztmp;
int ret = SUCCESS;
- if (Z_TYPE_P(newval) != IS_LONG) {
- ZVAL_COPY(&ztmp, newval);
- convert_to_long(&ztmp);
- newval = &ztmp;
- }
- snmp_object->exceptions_enabled = Z_LVAL_P(newval);
+ snmp_object->exceptions_enabled = zval_get_long(newval);
- if (newval == &ztmp) {
- zval_ptr_dtor(newval);
- }
return ret;
}
/* }}} */
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index b8f1911f69..08f750bea9 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -3250,16 +3250,13 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
Z_TYPE_P(proxy_host) == IS_STRING &&
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
Z_TYPE_P(proxy_port) == IS_LONG) {
- zval str_port, str_proxy;
+ zval str_proxy;
smart_str proxy = {0};
- ZVAL_DUP(&str_port, proxy_port);
- convert_to_string(&str_port);
smart_str_appends(&proxy,"tcp://");
smart_str_appends(&proxy,Z_STRVAL_P(proxy_host));
smart_str_appends(&proxy,":");
- smart_str_appends(&proxy,Z_STRVAL(str_port));
+ smart_str_append_long(&proxy,Z_LVAL_P(proxy_port));
smart_str_0(&proxy);
- zval_dtor(&str_port);
ZVAL_NEW_STR(&str_proxy, proxy.s);
if (!context) {
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index f963b8f343..e583ef6a02 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -940,29 +940,18 @@ PHP_FUNCTION(socket_select)
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (sec != NULL) {
- zval tmp;
-
- if (Z_TYPE_P(sec) != IS_LONG) {
- tmp = *sec;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- sec = &tmp;
- }
+ zend_long s = zval_get_long(sec);
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
+ tv.tv_sec = s + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = Z_LVAL_P(sec);
+ tv.tv_sec = s;
tv.tv_usec = usec;
}
tv_p = &tv;
-
- if (sec == &tmp) {
- zval_dtor(&tmp);
- }
}
retval = select(max_fd+1, &rfds, &wfds, &efds, tv_p);
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 5dc6b0a2a9..3d920b6461 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -235,26 +235,20 @@ static void php_print_gpcse_array(char *name, uint32_t name_length)
zend_print_zval_r(tmp, 0);
}
} else {
- ZVAL_COPY_VALUE(&tmp2, tmp);
- if (Z_TYPE(tmp2) != IS_STRING) {
- tmp = NULL;
- zval_copy_ctor(&tmp2);
- convert_to_string(&tmp2);
- }
+ zend_string *tmp2;
+ zend_string *str = zval_get_tmp_string(tmp, &tmp2);
if (!sapi_module.phpinfo_as_text) {
- if (Z_STRLEN(tmp2) == 0) {
+ if (ZSTR_LEN(str) == 0) {
php_info_print("<i>no value</i>");
} else {
- php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2));
+ php_info_print_html_esc(ZSTR_VAL(str), ZSTR_LEN(str));
}
} else {
- php_info_print(Z_STRVAL(tmp2));
+ php_info_print(ZSTR_VAL(str));
}
- if (!tmp) {
- zval_dtor(&tmp2);
- }
+ zend_tmp_string_release(tmp2);
}
if (!sapi_module.phpinfo_as_text) {
php_info_print("</td></tr>\n");
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 8e7b95e739..613c21ac34 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -415,8 +415,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
if (pipe_requested && stream && context) {
zval *blocking_pipes = php_stream_context_get_option(context, "pipe", "blocking");
if (blocking_pipes) {
- convert_to_long(blocking_pipes);
- php_stream_set_option(stream, PHP_STREAM_OPTION_PIPE_BLOCKING, Z_LVAL_P(blocking_pipes), NULL);
+ php_stream_set_option(stream, PHP_STREAM_OPTION_PIPE_BLOCKING, zval_get_long(blocking_pipes), NULL);
}
}
#endif
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index cff0f9c4c2..b8f318c572 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -1189,8 +1189,8 @@ done:
scan_set_error_return( numVars, return_value );
result = SCAN_ERROR_EOF;
} else if (numVars) {
- convert_to_long(return_value );
- Z_LVAL_P(return_value) = nconversions;
+ zval_ptr_dtor(return_value );
+ ZVAL_LONG(return_value, nconversions);
} else if (nconversions < totalVars) {
/* TODO: not all elements converted. we need to prune the list - cc */
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 0bbff62700..1ef96e9132 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2478,7 +2478,7 @@ PHP_FUNCTION(substr_replace)
if (argc > 3) {
if (Z_TYPE_P(len) != IS_ARRAY) {
convert_to_long_ex(len);
- l = zval_get_long(len);
+ l = Z_LVAL_P(len);
}
} else {
if (Z_TYPE_P(str) != IS_ARRAY) {
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index 8fc76436c4..59bcc86c29 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -173,20 +173,16 @@ PHP_FUNCTION(msg_set_queue)
/* now pull out members of data and set them in the stat buffer */
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid") - 1)) != NULL) {
- convert_to_long_ex(item);
- stat.msg_perm.uid = Z_LVAL_P(item);
+ stat.msg_perm.uid = zval_get_long(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid") - 1)) != NULL) {
- convert_to_long_ex(item);
- stat.msg_perm.gid = Z_LVAL_P(item);
+ stat.msg_perm.gid = zval_get_long(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode") - 1)) != NULL) {
- convert_to_long_ex(item);
- stat.msg_perm.mode = Z_LVAL_P(item);
+ stat.msg_perm.mode = zval_get_long(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes") - 1)) != NULL) {
- convert_to_long_ex(item);
- stat.msg_qbytes = Z_LVAL_P(item);
+ stat.msg_qbytes = zval_get_long(item);
}
if (msgctl(mq->id, IPC_SET, &stat) == 0) {
RETVAL_TRUE;
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 895a8152d9..63f8c968c3 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -499,9 +499,8 @@ static void TIDY_CALL php_tidy_panic(ctmbstr msg)
static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
{
TidyOption opt = tidyGetOptionByName(doc, optname);
- zval conv;
-
- ZVAL_COPY_VALUE(&conv, value);
+ zend_string *str, *tmp_str;
+ zend_long lval;
if (!opt) {
php_error_docref(NULL, E_NOTICE, "Unknown Tidy Configuration Option '%s'", optname);
@@ -515,37 +514,24 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
switch(tidyOptGetType(opt)) {
case TidyString:
- if (Z_TYPE(conv) != IS_STRING) {
- zval_copy_ctor(&conv);
- convert_to_string(&conv);
- }
- if (tidyOptSetValue(doc, tidyOptGetId(opt), Z_STRVAL(conv))) {
- if (Z_TYPE(conv) != Z_TYPE_P(value)) {
- zval_dtor(&conv);
- }
+ str = zval_get_tmp_string(value, &tmp_str);
+ if (tidyOptSetValue(doc, tidyOptGetId(opt), ZSTR_VAL(str))) {
+ zend_tmp_string_release(tmp_str);
return SUCCESS;
}
- if (Z_TYPE(conv) != Z_TYPE_P(value)) {
- zval_dtor(&conv);
- }
+ zend_tmp_string_release(tmp_str);
break;
case TidyInteger:
- if (Z_TYPE(conv) != IS_LONG) {
- zval_copy_ctor(&conv);
- convert_to_long(&conv);
- }
- if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) {
+ lval = zval_get_long(value);
+ if (tidyOptSetInt(doc, tidyOptGetId(opt), lval)) {
return SUCCESS;
}
break;
case TidyBoolean:
- if (Z_TYPE(conv) != IS_LONG) {
- zval_copy_ctor(&conv);
- convert_to_long(&conv);
- }
- if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_LVAL(conv))) {
+ lval = zval_get_long(value);
+ if (tidyOptSetBool(doc, tidyOptGetId(opt), lval)) {
return SUCCESS;
}
break;
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 4761844f44..3db00ab22f 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -1589,20 +1589,17 @@ PHP_FUNCTION(xml_parser_set_option)
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
- convert_to_long_ex(val);
- parser->case_folding = Z_LVAL_P(val);
+ parser->case_folding = zval_get_long(val);
break;
case PHP_XML_OPTION_SKIP_TAGSTART:
- convert_to_long_ex(val);
- parser->toffset = Z_LVAL_P(val);
+ parser->toffset = zval_get_long(val);
if (parser->toffset < 0) {
php_error_docref(NULL, E_NOTICE, "tagstart ignored, because it is out of range");
parser->toffset = 0;
}
break;
case PHP_XML_OPTION_SKIP_WHITE:
- convert_to_long_ex(val);
- parser->skipwhite = Z_LVAL_P(val);
+ parser->skipwhite = zval_get_long(val);
break;
case PHP_XML_OPTION_TARGET_ENCODING: {
xml_encoding *enc;
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index fbec784557..490c885b23 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -125,9 +125,7 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
@@ -160,9 +158,7 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
@@ -199,9 +195,7 @@ void xmlreader_write_property(zval *object, zval *member, zval *value, void **ca
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
}
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index c20a059467..926aaae7e2 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -881,8 +881,7 @@ static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type,
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -915,8 +914,7 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void **
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -954,8 +952,7 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac
int retval = 0;
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_COPY(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string_func(member));
member = &tmp_member;
cache_slot = NULL;
}