diff options
author | Nikita Popov <nikic@php.net> | 2015-06-11 19:41:43 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-06-11 23:23:57 +0200 |
commit | 5d3cf577aad15b119c137a873f468c0614f2eb2e (patch) | |
tree | abc522e177e51e526c5be4aef6cb42c911ed2cce /ext/pgsql/pgsql.c | |
parent | 25098f0f5c50249200b1dd80619c782d961287a2 (diff) | |
download | php-git-5d3cf577aad15b119c137a873f468c0614f2eb2e.tar.gz |
Make convert_to_* safe with rc>1
This only involves switching zval_dtor to zval_ptr_dtor for arrays
and making the convert_to_object for arrays a bit more generic.
All the other changes outside zend_operators.c just make use of
this new ability (use COPY instead of DUP).
What's still missing: Proper references handling. I've seen many
convert_to* calls that will break when a reference is used.
Also fixes bug #69788.
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r-- | ext/pgsql/pgsql.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index a65b7a0aa9..6965589154 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -4246,7 +4246,7 @@ PHP_FUNCTION(pg_copy_from) #if HAVE_PQPUTCOPYDATA ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), value) { zval tmp; - ZVAL_DUP(&tmp, value); + ZVAL_COPY(&tmp, value); convert_to_string_ex(&tmp); query = (char *)emalloc(Z_STRLEN(tmp) + 2); strlcpy(query, Z_STRVAL(tmp), Z_STRLEN(tmp) + 2); @@ -4270,7 +4270,7 @@ PHP_FUNCTION(pg_copy_from) #else ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), value) { zval tmp; - ZVAL_DUP(&tmp, value); + ZVAL_COPY(&tmp, value); convert_to_string_ex(&tmp); query = (char *)emalloc(Z_STRLEN(tmp) + 2); strlcpy(query, Z_STRVAL(tmp), Z_STRLEN(tmp) + 2); |