From: Greg Beaver Date: Fri, 8 Feb 2008 03:53:17 +0000 (+0000) Subject: SEPARATE_ZVAL does not work for this situation. We always want X-Git-Tag: RELEASE_2_0_0a1~571 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c31f04b5f332e8d0f6a6d67b3eeaadba38191c34;p=php SEPARATE_ZVAL does not work for this situation. We always want to duplicate and copy, so do it manually and reset refcount to 1 --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index ac6bcda797..c15cd5c103 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1549,7 +1549,20 @@ static void phar_convert_to_other(phar_archive_data *source, int convert, php_ui } newentry.filename = estrndup(newentry.filename, newentry.filename_len); if (newentry.metadata) { - SEPARATE_ZVAL(&(newentry.metadata)); + zval *t; + + t = newentry.metadata; + ALLOC_ZVAL(newentry.metadata); + *newentry.metadata = *t; + zval_copy_ctor(newentry.metadata); +#if PHP_VERSION_ID < 50300 + newentry.metadata.refcount = 1; +#else + Z_SET_REFCOUNT_P(newentry.metadata, 1); +#endif + + newentry.metadata_str.c = NULL; + newentry.metadata_str.len = 0; } newentry.is_zip = phar.is_zip; newentry.is_tar = phar.is_tar; @@ -2415,7 +2428,18 @@ PHP_METHOD(Phar, copy) memcpy((void *) &newentry, oldentry, sizeof(phar_entry_info)); if (newentry.metadata) { - SEPARATE_ZVAL(&(newentry.metadata)); + zval *t; + + t = newentry.metadata; + ALLOC_ZVAL(newentry.metadata); + *newentry.metadata = *t; + zval_copy_ctor(newentry.metadata); +#if PHP_VERSION_ID < 50300 + newentry.metadata.refcount = 1; +#else + Z_SET_REFCOUNT_P(newentry.metadata, 1); +#endif + newentry.metadata_str.c = NULL; newentry.metadata_str.len = 0; }