diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-12-23 04:29:41 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-12-23 04:29:41 +0300 |
commit | 6ec5ab77df816a66e480f2d3dcf4f917c4390833 (patch) | |
tree | 12af36d9602e9a6080276b228911bb38e43fd210 /ext/simplexml/simplexml.c | |
parent | dedf44bacce095737c3cd9457da218033f61b39a (diff) | |
download | php-git-6ec5ab77df816a66e480f2d3dcf4f917c4390833.tar.gz |
Improved trim/ltrim/rtrim functions.
Now php_trim() operates on zend_string and returns zend_string (it may return the same zend_string).
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r-- | ext/simplexml/simplexml.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 692b5d368a..edaa48ba22 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -456,7 +456,8 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool int new_value = 0; zend_long cnt = 0; int retval = SUCCESS; - zval tmp_zv, trim_zv, zval_copy; + zval tmp_zv, zval_copy; + zend_string *trim_str; sxe = Z_SXEOBJ_P(object); @@ -474,9 +475,9 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool } } else { if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&trim_zv, zval_get_string(member)); - php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3); - zval_dtor(&trim_zv); + trim_str = zval_get_string(member); + ZVAL_STR(&tmp_zv, php_trim(trim_str, NULL, 0, 3)); + zend_string_release(trim_str); member = &tmp_zv; } |