pajoye Sun Sep 24 22:27:57 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/zip/tests 38943.phpt
Modified files: /php-src/ext/zip php_zip.c Log: - #38943, properties in extended class cannot be set - use zend_object_std_init instead of a manual initialisation http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.14&r2=1.1.2.15&diff_format=u Index: php-src/ext/zip/php_zip.c diff -u php-src/ext/zip/php_zip.c:1.1.2.14 php-src/ext/zip/php_zip.c:1.1.2.15 --- php-src/ext/zip/php_zip.c:1.1.2.14 Fri Sep 15 12:12:25 2006 +++ php-src/ext/zip/php_zip.c Sun Sep 24 22:27:57 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.1.2.14 2006/09/15 12:12:25 pajoye Exp $ */ +/* $Id: php_zip.c,v 1.1.2.15 2006/09/24 22:27:57 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -526,7 +526,6 @@ intern = emalloc(sizeof(ze_zip_object)); memset(&intern->zo, 0, sizeof(zend_object)); - intern->zo.ce = class_type; intern->za = NULL; intern->buffers = NULL; @@ -534,8 +533,7 @@ intern->buffers_cnt = 0; intern->prop_handler = &zip_prop_handlers; - ALLOC_HASHTABLE(intern->zo.properties); - zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); @@ -1895,7 +1893,6 @@ memcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zip_object_handlers.clone_obj = NULL; zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; - zip_object_handlers.write_property = NULL; zip_object_handlers.get_properties = php_zip_get_properties; zip_object_handlers.read_property = php_zip_read_property; @@ -1987,7 +1984,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.14 2006/09/15 12:12:25 pajoye Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.15 2006/09/24 22:27:57 pajoye Exp $"); php_info_print_table_row(2, "Zip version", "2.0.0"); php_info_print_table_row(2, "Libzip version", "0.7.1"); http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/38943.phpt?view=markup&rev=1.1 Index: php-src/ext/zip/tests/38943.phpt +++ php-src/ext/zip/tests/38943.phpt --TEST-- #38943, properties in extended class cannot be set --SKIPIF-- <?php /* $Id: 38943.phpt,v 1.1 2006/09/24 22:27:20 pajoye Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- <?php class myZip extends ZipArchive { private $test = 0; public $testp = 1; private $testarray = array(); public function __construct() { $this->testarray[] = 1; var_dump($this->testarray); } } $z = new myZip; $z->testp = "foobar"; var_dump($z); ?> --EXPECTF-- array(1) { [0]=> int(1) } object(myZip)#1 (%d) { ["test:private"]=> int(0) ["testp"]=> string(6) "foobar" ["testarray:private"]=> array(1) { [0]=> int(1) } ["status"]=> int(0) ["statusSys"]=> int(0) ["numFiles"]=> int(0) ["filename"]=> string(0) "" ["comment"]=> string(0) "" } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php