[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c
colder Thu Mar 19 03:01:37 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_array.c /php-srcNEWS Log: MFH: Fix #47231 (offsetGet error using incorrect offset) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.38r2=1.71.2.17.2.13.2.39diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.38 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.39 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.38 Tue Jan 27 14:50:27 2009 +++ php-src/ext/spl/spl_array.c Thu Mar 19 03:01:37 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.38 2009/01/27 14:50:27 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.39 2009/03/19 03:01:37 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -346,7 +346,7 @@ zend_hash_index_find(ht, index, (void **) retval); return retval; } else { - zend_error(E_NOTICE, Undefined offset: %ld, Z_LVAL_P(offset)); + zend_error(E_NOTICE, Undefined offset: %ld, index); return EG(uninitialized_zval_ptr); } } else { http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.525r2=1.2027.2.547.2.965.2.526diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.525 php-src/NEWS:1.2027.2.547.2.965.2.526 --- php-src/NEWS:1.2027.2.547.2.965.2.525 Thu Mar 19 02:45:17 2009 +++ php-src/NEWSThu Mar 19 03:01:37 2009 @@ -31,6 +31,7 @@ - Fixed bug #47320 ($php_errormsg out of scope in functions). (Dmitry) - Fixed bug #47265 (generating phar.phar fails because of safe_mode). (Greg) - Fixed bug #47243 (OCI8: Crash at shutdown on Windows) (Chris Jones/Oracle Corp.) +- Fixed bug #47231 (offsetGet error using incorrect offset). (Etienne) - Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno) - Fixed bug #47085 (rename() returns true even if the file in PHAR does not exist). (Greg) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests array_018.phpt
colder Tue Dec 30 23:34:29 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS /php-src/ext/splspl_array.c /php-src/ext/spl/tests array_018.phpt Log: MFH: Fix #45820 (Empty ArrayObject keys not allowed) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.427r2=1.2027.2.547.2.965.2.428diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.427 php-src/NEWS:1.2027.2.547.2.965.2.428 --- php-src/NEWS:1.2027.2.547.2.965.2.427 Mon Dec 29 09:58:18 2008 +++ php-src/NEWSTue Dec 30 23:34:29 2008 @@ -33,6 +33,7 @@ (Scott) - Fixed bug #45989 (json_decode() doesn't return NULL on certain invalid strings). (magicaltux, Scott) +- Fixed bug #45820 (Allow empty keys in ArrayObject). (Etienne) - Fixed bug #45791 (json_decode() doesn't convert 0e0 to a double). (Scott) 04 Dec 2008, PHP 5.3.0 Alpha 3 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.35r2=1.71.2.17.2.13.2.36diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.35 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.36 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.35 Wed Nov 19 17:53:47 2008 +++ php-src/ext/spl/spl_array.c Tue Dec 30 23:34:29 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.35 2008/11/19 17:53:47 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.36 2008/12/30 23:34:29 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -433,10 +433,6 @@ } switch(Z_TYPE_P(offset)) { case IS_STRING: - if (*Z_STRVAL_P(offset) == '\0') { - zend_throw_exception(spl_ce_InvalidArgumentException, An offset must not begin with \\0 or be empty, 0 TSRMLS_CC); - return; - } Z_ADDREF_P(value); zend_symtable_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL); return; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_018.phpt?r1=1.1.2.2.4.2r2=1.1.2.2.4.3diff_format=u Index: php-src/ext/spl/tests/array_018.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c
lbarnaudWed Nov 19 14:41:41 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_array.c /php-srcNEWS Log: Improved ArrayObject performance (made spl_hash_verify_pos() an O(1) and removed some spl_array_get_hash_table() calls). Fixes #46039 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.33r2=1.71.2.17.2.13.2.34diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.33 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.34 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.33 Wed Nov 19 02:00:53 2008 +++ php-src/ext/spl/spl_array.c Wed Nov 19 14:41:40 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.33 2008/11/19 02:00:53 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.34 2008/11/19 14:41:40 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -63,6 +63,7 @@ zval *array; zval *retval; HashPosition pos; + ulong pos_h; intar_flags; intis_self; zend_function *fptr_offset_get; @@ -92,24 +93,44 @@ static void spl_array_rewind(spl_array_object *intern TSRMLS_DC); -SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */ +static void spl_array_update_pos(spl_array_object* intern) /* {{{ */ +{ + Bucket *pos; + if ((pos = intern-pos)) { + intern-pos_h = pos-h; + } +} /* }}} */ + +static void spl_array_set_pos(spl_array_object* intern, HashPosition pos) /* {{{ */ +{ + intern-pos = pos; + spl_array_update_pos(intern); +} /* }}} */ + +SPL_API int spl_hash_verify_pos_ex(spl_array_object * intern, HashTable * ht TSRMLS_DC) /* {{{ */ { - HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); Bucket *p; /* IS_CONSISTENT(ht);*/ /* HASH_PROTECT_RECURSION(ht);*/ - p = ht-pListHead; + p = ht-arBuckets[intern-pos_h ht-nTableMask]; while (p != NULL) { if (p == intern-pos) { return SUCCESS; } - p = p-pListNext; + p = p-pNext; } /* HASH_UNPROTECT_RECURSION(ht); */ spl_array_rewind(intern TSRMLS_CC); return FAILURE; + +} /* }}} */ + +SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */ +{ + HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + return spl_hash_verify_pos_ex(intern, ht TSRMLS_CC); } /* }}} */ @@ -609,7 +630,7 @@ spl_array_write_dimension(object, NULL, append_value TSRMLS_CC); if (!intern-pos) { - intern-pos = aht-pListTail; + spl_array_set_pos(intern, aht-pListTail); } } /* }}} */ @@ -749,12 +770,11 @@ std_object_handlers.unset_property(object, member TSRMLS_CC); } /* }}} */ -static int spl_array_skip_protected(spl_array_object *intern TSRMLS_DC) /* {{{ */ +static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { char *string_key; uint string_length; ulong num_key; - HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (Z_TYPE_P(intern-array) == IS_OBJECT) { do { @@ -769,27 +789,39 @@ return FAILURE; } zend_hash_move_forward_ex(aht, intern-pos); + spl_array_update_pos(intern); } while (1); } return FAILURE; -} -/* }}} */ +} /* }}} */ -static int spl_array_next(spl_array_object *intern TSRMLS_DC) /* {{{ */ +static int spl_array_next_no_verify(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { - HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + zend_hash_move_forward_ex(aht, intern-pos); + spl_array_update_pos(intern); + if (Z_TYPE_P(intern-array) == IS_OBJECT) { + return spl_array_skip_protected(intern, aht TSRMLS_CC); + } else { + return zend_hash_has_more_elements_ex(aht, intern-pos); + } +} /* }}} */ - if ((intern-ar_flags SPL_ARRAY_IS_REF) spl_hash_verify_pos(intern TSRMLS_CC) == FAILURE) { +static int spl_array_next_ex(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ +{ + if ((intern-ar_flags SPL_ARRAY_IS_REF) spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was modified outside object and internal position is no longer valid); return FAILURE; - } else { - zend_hash_move_forward_ex(aht, intern-pos); - if (Z_TYPE_P(intern-array) ==
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests array_026.phpt
colder Sun Oct 5 14:20:55 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests array_026.phpt Modified files: /php-srcNEWS /php-src/ext/splspl_array.c Log: Fix #46222 (Allow indirect modifications of Arrays inside ArrayObject + fix EG(uninitialized_zval_ptr) overwrite) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.338r2=1.2027.2.547.2.965.2.339diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.338 php-src/NEWS:1.2027.2.547.2.965.2.339 --- php-src/NEWS:1.2027.2.547.2.965.2.338 Wed Oct 1 20:30:23 2008 +++ php-src/NEWSSun Oct 5 14:20:54 2008 @@ -45,6 +45,8 @@ (vnegrier at optilian dot com, Ilia) - Fixed bug #46192 (ArrayObject with objects as storage serialization). (Etienne) +- Fixed bug #46222 (ArrayObject EG(uninitialized_var_ptr) overwrite). + (Etienne) 02 Sep 2008, PHP 5.3.0 Alpha 2 - Removed special treatment of /tmp in sessions for open_basedir. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.26r2=1.71.2.17.2.13.2.27diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.26 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.27 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.26 Mon Sep 29 22:45:27 2008 +++ php-src/ext/spl/spl_array.c Sun Oct 5 14:20:55 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.26 2008/09/29 22:45:27 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.27 2008/10/05 14:20:55 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -281,6 +281,7 @@ spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); zval **retval; long index; + HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); /* We cannot get the pointer pointer so we don't allow it here for now if (check_inherited intern-fptr_offset_get) { @@ -293,9 +294,17 @@ switch(Z_TYPE_P(offset)) { case IS_STRING: - if (zend_symtable_find(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval) == FAILURE) { - zend_error(E_NOTICE, Undefined index: %s, Z_STRVAL_P(offset)); - return EG(uninitialized_zval_ptr); + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval) == FAILURE) { + if (type == BP_VAR_W || type == BP_VAR_RW) { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL); + zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval); + return retval; + } else { + zend_error(E_NOTICE, Undefined index: %s, Z_STRVAL_P(offset)); + return EG(uninitialized_zval_ptr); + } } else { return retval; } @@ -308,9 +317,17 @@ } else { index = Z_LVAL_P(offset); } - if (zend_hash_index_find(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index, (void **) retval) == FAILURE) { - zend_error(E_NOTICE, Undefined offset: %ld, Z_LVAL_P(offset)); - return EG(uninitialized_zval_ptr); + if (zend_hash_index_find(ht, index, (void **) retval) == FAILURE) { + if (type == BP_VAR_W || type == BP_VAR_RW) { + zval *value; + ALLOC_INIT_ZVAL(value); + zend_hash_index_update(ht, index, (void**)value, sizeof(void*), NULL); + zend_hash_index_find(ht, index, (void **) retval); + return retval; + } else { + zend_error(E_NOTICE, Undefined offset: %ld, Z_LVAL_P(offset)); + return EG(uninitialized_zval_ptr); + } } else { return retval; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_026.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/array_026.phpt +++ php-src/ext/spl/tests/array_026.phpt --TEST-- SPL: ArrayObject indirect offsetGet overwriting EG(uninitialized_zvar_ptr) --FILE-- ?php $test = new ArrayObject(); $test['d1']['d2'] = 'hello'; $test['d1']['d3'] = 'world'; var_dump($test, $test3['m']); ? --EXPECTF-- Notice: Undefined
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests array_025.phpt
colder Mon Sep 29 22:45:28 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests array_025.phpt Modified files: /php-src/ext/splspl_array.c /php-srcNEWS Log: MFH: Fix #46192 (Serialization of ArrayObject with objects as storage) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.25r2=1.71.2.17.2.13.2.26diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.25 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.26 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.25 Fri Sep 19 12:48:33 2008 +++ php-src/ext/spl/spl_array.c Mon Sep 29 22:45:27 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.25 2008/09/19 12:48:33 dmitry Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.26 2008/09/29 22:45:27 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1593,7 +1593,7 @@ ++p; if (*p!='m') { - if (*p!='a') { + if (*p!='a' *p!='O' *p!='C') { goto outexcept; } intern-ar_flags = ~SPL_ARRAY_CLONE_MASK; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.333r2=1.2027.2.547.2.965.2.334diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.333 php-src/NEWS:1.2027.2.547.2.965.2.334 --- php-src/NEWS:1.2027.2.547.2.965.2.333 Mon Sep 29 16:53:08 2008 +++ php-src/NEWSMon Sep 29 22:45:28 2008 @@ -35,6 +35,8 @@ - Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Ilia) - Fixed bug #45382 (timeout bug in stream_socket_enable_crypto). (vnegrier at optilian dot com, Ilia) +- Fixed bug #46192 (ArrayObject with objects as storage serialization). + (Etienne) 02 Sep 2008, PHP 5.3.0 Alpha 2 - Removed special treatment of /tmp in sessions for open_basedir. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_025.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/array_025.phpt +++ php-src/ext/spl/tests/array_025.phpt --TEST-- SPL: ArrayObject serialize with an object as storage --FILE-- ?php $obj1 = new ArrayObject(new ArrayObject(array(1,2))); $s = serialize($obj1); $obj2 = unserialize($s); print_r($obj1); echo $s\n; print_r($obj2); ? --EXPECT-- ArrayObject Object ( [storage:ArrayObject:private] = ArrayObject Object ( [storage:ArrayObject:private] = Array ( [0] = 1 [1] = 2 ) ) ) C:11:ArrayObject:76:{x:i:0;C:11:ArrayObject:37:{x:i:0;a:2:{i:0;i:1;i:1;i:2;};m:a:0:{}};m:a:0:{}} ArrayObject Object ( [storage:ArrayObject:private] = ArrayObject Object ( [storage:ArrayObject:private] = Array ( [0] = 1 [1] = 2 ) ) ) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests bug46115.phpt
dmitry Fri Sep 19 12:48:34 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug46115.phpt Modified files: /php-srcNEWS /php-src/ext/splspl_array.c Log: Fixed bug #46115 (Memory leak when calling a method using Reflection) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.326r2=1.2027.2.547.2.965.2.327diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.326 php-src/NEWS:1.2027.2.547.2.965.2.327 --- php-src/NEWS:1.2027.2.547.2.965.2.326 Thu Sep 18 16:09:18 2008 +++ php-src/NEWSFri Sep 19 12:48:33 2008 @@ -10,6 +10,8 @@ - Fixed bug causing the algorithm parameter of mhash() to be modified. (Scott) +- Fixed bug #46115 (Memory leak when calling a method using Reflection). + (Dmitry) - Fixed bug #46106 (Memory leaks when using global statement). (Dmitry) - Fixed bug #46099 (Xsltprocessor::setProfiling - memory leak). (Felipe, Rob). - Fixed bug #46087 (DOMXPath - segfault on destruction of a cloned object). http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.24r2=1.71.2.17.2.13.2.25diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.24 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.25 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.24 Mon Aug 25 19:38:04 2008 +++ php-src/ext/spl/spl_array.c Fri Sep 19 12:48:33 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.24 2008/08/25 19:38:04 rrichards Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.25 2008/09/19 12:48:33 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1235,6 +1235,7 @@ spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); zval *tmp, *arg; + zval *retval_ptr = NULL; MAKE_STD_ZVAL(tmp); Z_TYPE_P(tmp) = IS_ARRAY; @@ -1245,12 +1246,15 @@ zend_throw_exception(spl_ce_BadMethodCallException, Function expects exactly one argument, 0 TSRMLS_CC); return; } - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 2, tmp, arg TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, retval_ptr, 2, tmp, arg TSRMLS_CC); } else { - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 1, tmp, NULL TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, retval_ptr, 1, tmp, NULL TSRMLS_CC); } Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the hashtable */ zval_ptr_dtor(tmp); + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + } } /* }}} */ #define SPL_ARRAY_METHOD(cname, fname, use_arg) \ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug46115.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug46115.phpt +++ php-src/ext/spl/tests/bug46115.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests bug45826.phpt
colder Mon Aug 25 18:40:46 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug45826.phpt Modified files: /php-src/ext/splspl_array.c /php-srcNEWS Log: MFH: Fix #45826 (Custom serialization) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.21r2=1.71.2.17.2.13.2.22diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.21 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.22 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.21 Fri Aug 8 22:07:07 2008 +++ php-src/ext/spl/spl_array.c Mon Aug 25 18:40:44 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.21 2008/08/08 22:07:07 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.22 2008/08/25 18:40:44 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -59,18 +59,22 @@ #define SPL_ARRAY_CLONE_MASK 0x0300 typedef struct _spl_array_object { - zend_object std; - zval *array; - zval *retval; - HashPosition pos; - int ar_flags; - int is_self; - zend_function *fptr_offset_get; - zend_function *fptr_offset_set; - zend_function *fptr_offset_has; - zend_function *fptr_offset_del; - zend_function *fptr_count; - zend_class_entry* ce_get_iterator; + zend_objectstd; + zval *array; + zval *retval; + HashPosition pos; + intar_flags; + intis_self; + zend_function *fptr_offset_get; + zend_function *fptr_offset_set; + zend_function *fptr_offset_has; + zend_function *fptr_offset_del; + zend_function *fptr_count; + zend_function *fptr_serialize; + zend_function *fptr_unserialize; + zend_class_entry *ce_get_iterator; + php_serialize_data_t *serialize_data; + php_unserialize_data_t *unserialize_data; } spl_array_object; static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int check_std_props TSRMLS_DC) { /* {{{ */ @@ -124,6 +128,8 @@ /* }}} */ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); +int spl_array_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +int spl_array_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); /* {{{ spl_array_object_new_ex */ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC) @@ -143,6 +149,8 @@ zend_hash_copy(intern-std.properties, class_type-default_properties, (copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *)); intern-ar_flags = 0; + intern-serialize_data = NULL; + intern-unserialize_data = NULL; intern-ce_get_iterator = spl_ce_ArrayIterator; if (orig) { spl_array_object *other = (spl_array_object*)zend_object_store_get_object(orig TSRMLS_CC); @@ -208,6 +216,14 @@ if (intern-fptr_count-common.scope == parent) { intern-fptr_count = NULL; } + zend_hash_find(class_type-function_table, serialize, sizeof(serialize),(void **) intern-fptr_serialize); + if (intern-fptr_serialize-common.scope == parent) { + intern-fptr_serialize = NULL; + } + zend_hash_find(class_type-function_table, unserialize, sizeof(unserialize), (void **) intern-fptr_unserialize); + if (intern-fptr_unserialize-common.scope == parent) { + intern-fptr_unserialize = NULL; + } } /* Cache iterator functions if ArrayIterator or derived. Check current's */ /* cache since only current is always required */ @@ -1440,32 +1456,27 @@ } /* }}} */ -/* {{{ proto string ArrayObject::serialize() - * serialize the object - */ -SPL_METHOD(Array, serialize) -{ - zval *object = getThis(); - spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); +smart_str spl_array_serialize_helper(spl_array_object *intern, php_serialize_data_t *var_hash_p TSRMLS_DC) { /* {{{ */ HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); zval members, *pmembers; - php_serialize_data_t var_hash; smart_str buf = {0}; + zval *flags; if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, Array was
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests bug45622.phpt
lbarnaudSat Jul 26 12:34:11 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug45622.phpt Modified files: /php-srcNEWS /php-src/ext/splspl_array.c Log: MFH: Fix bug #45622 (isset($arrayObject-p) misbehaves with ArrayObject::ARRAY_AS_PROPS set) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.222r2=1.2027.2.547.2.965.2.223diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.222 php-src/NEWS:1.2027.2.547.2.965.2.223 --- php-src/NEWS:1.2027.2.547.2.965.2.222 Fri Jul 25 08:27:37 2008 +++ php-src/NEWSSat Jul 26 12:34:10 2008 @@ -222,6 +222,8 @@ - Fixed PECL bug #12431 (OCI8 ping functionality is broken). (Oracle Corp.) - Fixed PECL bug #12401 (Add support for ATTR_FETCH_TABLE_NAMES). (Johannes) +- Fixed bug #45622 (isset($arrayObject-p) misbehaves with ArrayObject:: + ARRAY_AS_PROPS set). (robin_fernandes at uk dot ibm dot com, Arnaud) - Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private prop of wrapped object). (robin_fernandes at uk dot ibm dot com, Arnaud) - Fixed bug #45571 (ReflectionClass::export() shows superclasses' private http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.18r2=1.71.2.17.2.13.2.19diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.18 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.19 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.18 Thu Jul 24 15:54:41 2008 +++ php-src/ext/spl/spl_array.c Sat Jul 26 12:34:10 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.18 2008/07/24 15:54:41 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.19 2008/07/26 12:34:10 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -695,13 +695,12 @@ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - if ((intern-ar_flags SPL_ARRAY_ARRAY_AS_PROPS) != 0) { - if (!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { - return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); - } - return 0; /* if prop doesn't exist at all mode 0/1 cannot return 1 */ + if (std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC)) { + return 1; + } else if ((intern-ar_flags SPL_ARRAY_ARRAY_AS_PROPS) != 0) { + return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); } - return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC); + return 0; } /* }}} */ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45622.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug45622.phpt +++ php-src/ext/spl/tests/bug45622.phpt --TEST-- SPL: Bug #45622 (isset($arrayObject-p) misbehaves with ArrayObject::ARRAY_AS_PROPS set --FILE-- ?php class C extends ArrayObject { public $p = 'object property'; } $ao = new C(array('p'='array element')); $ao-setFlags(ArrayObject::ARRAY_AS_PROPS); echo \n-- Access the real property:\n; var_dump(isset($ao-p)); var_dump($ao-p); echo \n-- Remove the real property and access the array element:\n; unset($ao-p); var_dump(isset($ao-p)); var_dump($ao-p); echo \n-- Remove the array element and try access again:\n; unset($ao-p); var_dump(isset($ao-p)); var_dump($ao-p); echo \n-- Re-add the real property:\n; $ao-p = 'object property'; var_dump(isset($ao-p)); var_dump($ao-p); ? --EXPECTF-- -- Access the real property: bool(true) %unicode|string%(15) object property -- Remove the real property and access the array element: bool(true) %unicode|string%(13) array element -- Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line %d NULL -- Re-add the real property: bool(true) %unicode|string%(15) object property -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests bug45614.phpt
lbarnaudThu Jul 24 15:54:41 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug45614.phpt Modified files: /php-srcNEWS /php-src/ext/splspl_array.c Log: MFH: Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private prop of wrapped object) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.219r2=1.2027.2.547.2.965.2.220diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.219 php-src/NEWS:1.2027.2.547.2.965.2.220 --- php-src/NEWS:1.2027.2.547.2.965.2.219 Thu Jul 24 14:38:37 2008 +++ php-src/NEWSThu Jul 24 15:54:41 2008 @@ -219,6 +219,8 @@ - Fixed PECL bug #12431 (OCI8 ping functionality is broken). (Oracle Corp.) - Fixed PECL bug #12401 (Add support for ATTR_FETCH_TABLE_NAMES). (Johannes) +- Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private + prop of wrapped object). (robin_fernandes at uk dot ibm dot com, Arnaud) - Fixed bug #45571 (ReflectionClass::export() shows superclasses' private static methods). (robin_fernandes at uk dot ibm dot com) - Fixed bug #45345 (SPLFileInfo::getPathInfo() returning dir info instead of http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.17r2=1.71.2.17.2.13.2.18diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.17 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.18 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.17 Sun Jul 20 16:32:55 2008 +++ php-src/ext/spl/spl_array.c Thu Jul 24 15:54:41 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.17 2008/07/20 16:32:55 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.18 2008/07/24 15:54:41 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -86,6 +86,8 @@ } } /* }}} */ +static void spl_array_rewind(spl_array_object *intern TSRMLS_DC); + SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */ { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -102,7 +104,7 @@ p = p-pListNext; } /* HASH_UNPROTECT_RECURSION(ht); */ - zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), intern-pos); + spl_array_rewind(intern TSRMLS_CC); return FAILURE; } /* }}} */ @@ -226,7 +228,7 @@ } } - zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), intern-pos); + spl_array_rewind(intern TSRMLS_CC); return retval; } /* }}} */ @@ -702,8 +704,6 @@ return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC); } /* }}} */ -static void spl_array_rewind(spl_array_object *intern TSRMLS_DC); - static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -1164,7 +1164,7 @@ opos = position; if (position = 0) { /* negative values are not supported */ - zend_hash_internal_pointer_reset_ex(aht, intern-pos); + spl_array_rewind(intern TSRMLS_CC); result = SUCCESS; while (position-- 0 (result = spl_array_next(intern TSRMLS_CC)) == SUCCESS); @@ -1192,7 +1192,7 @@ * we're going to call and which do not support 'pos' as parameter. */ pos = intern-pos; *count = 0; - zend_hash_internal_pointer_reset_ex(aht, intern-pos); + spl_array_rewind(intern TSRMLS_CC); while(intern-pos spl_array_next(intern TSRMLS_CC) == SUCCESS) { (*count)++; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45614.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug45614.phpt +++ php-src/ext/spl/tests/bug45614.phpt --TEST-- SPL: Bug#45614 (ArrayIterator can show 1st private prop of wrapped object) --FILE-- ?php class C { private $priv1 = 'secret1'; private $priv2 = 'secret2'; public $pub1 = 'public1'; public $pub2 = 'public2'; public $pub3 = 'public3'; } function showFirstTwoItems($it) { echo str_replace(\0, '\0', $it-key()) . = . $it-current() . \n; $it-next(); echo str_replace(\0, '\0', $it-key()) . = . $it-current() . \n; } $ao = new ArrayObject(new C); $ai = $ao-getIterator(); echo -- Show the first two items:\n; showFirstTwoItems($ai); echo \n-- Rewind and show the first two items:\n; $ai-rewind(); showFirstTwoItems($ai); echo \n-- Invalidate current position and show the first two items:\n; unset($ai[$ai-key()]); $ai-current(); showFirstTwoItems($ai); echo \n-- Rewind, seek and show the first two items:\n; $ai-rewind();