[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests arrayObject_magicMethods6.phpt bug45622b.phpt
lbarnaudThu May 21 13:26:29 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug45622b.phpt Modified files: /php-src/ext/splspl_array.c /php-src/ext/spl/tests arrayObject_magicMethods6.phpt Log: MFH: Better fix for #45622 (patch by robinf at php do net) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.24r2=1.71.2.17.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.24 php-src/ext/spl/spl_array.c:1.71.2.17.2.25 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.24 Thu May 14 16:44:54 2009 +++ php-src/ext/spl/spl_array.c Thu May 21 13:26:29 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.24 2009/05/14 16:44:54 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.25 2009/05/21 13:26:29 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -671,12 +671,12 @@ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - 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) { + if ((intern-ar_flags SPL_ARRAY_ARRAY_AS_PROPS) != 0 +!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); } - return 0; + return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC); + } /* }}} */ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u Index: php-src/ext/spl/tests/arrayObject_magicMethods6.phpt diff -u php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2 php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.3 --- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2Thu May 14 16:44:54 2009 +++ php-src/ext/spl/tests/arrayObject_magicMethods6.phptThu May 21 13:26:29 2009 @@ -133,11 +133,8 @@ } -- isset existent, non-existent and dynamic: -In UsesMagic::__isset(a) bool(true) -In UsesMagic::__isset(nonexistent) bool(false) -In UsesMagic::__isset(dynamic) bool(true) Original wrapped object: object(C)#%d (5) { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45622b.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug45622b.phpt +++ php-src/ext/spl/tests/bug45622b.phpt --TEST-- Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::ARRAY_AS_PROPS is used. --FILE-- ?php class UsesMagic extends ArrayObject { function __get($n) { echo In . __METHOD__ . !\n; } function __set($n, $v) { echo In . __METHOD__ . !\n; } function __isset($n) { echo In . __METHOD__ . !\n; } function __unset($n) { echo In . __METHOD__ . !\n; } } $ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS); echo Doesn't trigger __get.\n; echo $ao-prop1; echo Doesn't trigger __set.\n; $ao-prop2 = 'foo'; echo Doesn't trigger __unset.\n; unset($ao-prop3); echo Shouldn't trigger __isset.\n; isset($ao-prop4); ? --EXPECTF-- Doesn't trigger __get. Notice: Undefined index: prop1 in %s on line 11 Doesn't trigger __set. Doesn't trigger __unset. Notice: Undefined index: prop3 in %s on line 17 Shouldn't trigger __isset. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests bug45614.phpt
lbarnaudThu May 14 16:43:38 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug45614.phpt Modified files: /php-src/ext/splspl_array.c Log: MFB: Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private prop of wrapped object) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.22r2=1.71.2.17.2.23diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.22 php-src/ext/spl/spl_array.c:1.71.2.17.2.23 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.22 Wed Dec 31 11:17:44 2008 +++ php-src/ext/spl/spl_array.c Thu May 14 16:43:38 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.22 2008/12/31 11:17:44 sebastian Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.23 2009/05/14 16:43:38 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -82,6 +82,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); @@ -98,7 +100,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; } /* }}} */ @@ -218,7 +220,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; } /* }}} */ @@ -678,8 +680,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); @@ -1126,7 +1126,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); @@ -1155,7 +1155,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(); $ai-seek(0); showFirstTwoItems($ai); ? --EXPECT-- -- Show the first two items: pub1 = public1 pub2 = public2 -- Rewind and show the first two items: pub1 = public1 pub2 = public2 -- Invalidate current position and show the first two items: pub1 = public1 pub3 = public3 -- Rewind, seek and show the first two items: pub1 = public1 pub3 = public3 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests arrayObject___construct_basic4.phpt arrayObject___construct_basic5.phpt arrayObject_magicMethods6.phpt arrayObject_setFlags_basic1.
lbarnaudThu May 14 16:44:54 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug45622.phpt Modified files: /php-src/ext/spl/tests arrayObject___construct_basic4.phpt arrayObject___construct_basic5.phpt arrayObject_setFlags_basic1.phpt arrayObject_magicMethods6.phpt /php-src/ext/splspl_array.c Log: MFB: Fixed bug #45622 (isset($arrayObject-p) misbehaves with ArrayObject::ARRAY_AS_PROPS set) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject___construct_basic4.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject___construct_basic4.phpt diff -u php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject___construct_basic4.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Will fail until the fix to bug 45622 is backported from PHP53 to PHP52. --FILE-- ?php class C { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject___construct_basic5.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject___construct_basic5.phpt diff -u php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject___construct_basic5.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Will fail unless the PHP53 fix to bug 45622 is backported to PHP52 --FILE-- ?php class C { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt diff -u php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Currently fails on php.net due to bug 45622. --FILE-- ?php class C extends ArrayObject { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject_magicMethods6.phpt diff -u php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.1Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject_magicMethods6.phptThu May 14 16:44:54 2009 @@ -133,8 +133,11 @@ } -- isset existent, non-existent and dynamic: +In UsesMagic::__isset(a) bool(true) +In UsesMagic::__isset(nonexistent) bool(false) +In UsesMagic::__isset(dynamic) bool(true) Original wrapped object: object(C)#%d (5) { @@ -183,4 +186,4 @@ int(3) [priv:private]= string(6) secret -} \ No newline at end of file +} http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.23r2=1.71.2.17.2.24diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.23 php-src/ext/spl/spl_array.c:1.71.2.17.2.24 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.23 Thu May 14 16:43:38 2009 +++ php-src/ext/spl/spl_array.c Thu May 14 16:44:54 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.23 2009/05/14 16:43:38 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.24 2009/05/14 16:44:54 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -671,13 +671,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) { +
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests arrayObject___construct_error1.phpt arrayObject_setIteratorClass_error1.phpt
colder Sun Oct 19 18:00:42 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c /php-src/ext/spl/tests arrayObject___construct_error1.phpt arrayObject_setIteratorClass_error1.phpt Log: MFB: Fix #46317 (Iterator class not properly checked) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.20r2=1.71.2.17.2.21diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.20 php-src/ext/spl/spl_array.c:1.71.2.17.2.21 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.20 Sat Oct 18 09:33:21 2008 +++ php-src/ext/spl/spl_array.c Sun Oct 19 18:00:42 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.20 2008/10/18 09:33:21 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.21 2008/10/19 18:00:42 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -910,9 +910,7 @@ spl_array_object *intern; zval **array; long ar_flags = 0; - char *class_name; - int class_name_len; - zend_class_entry ** pce_get_iterator; + zend_class_entry * ce_get_iterator = spl_ce_Iterator; if (ZEND_NUM_ARGS() == 0) { return; /* nothing to do */ @@ -921,7 +919,7 @@ intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|ls, array, ar_flags, class_name, class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|lC, array, ar_flags, ce_get_iterator) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -931,12 +929,7 @@ } if (ZEND_NUM_ARGS() 2) { - if (zend_lookup_class(class_name, class_name_len, pce_get_iterator TSRMLS_CC) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, A class that implements Iterator must be specified, 0 TSRMLS_CC); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - return; - } - intern-ce_get_iterator = *pce_get_iterator; + intern-ce_get_iterator = ce_get_iterator; } ar_flags = ~SPL_ARRAY_INT_MASK; @@ -989,21 +982,14 @@ { zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - char *class_name; - int class_name_len; - zend_class_entry ** pce_get_iterator; + zend_class_entry * ce_get_iterator = spl_ce_Iterator; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, class_name, class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, C, ce_get_iterator) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } - if (zend_lookup_class(class_name, class_name_len, pce_get_iterator TSRMLS_CC) == FAILURE) { - zend_throw_exception(spl_ce_InvalidArgumentException, A class that implements Iterator must be specified, 0 TSRMLS_CC); - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - return; - } - intern-ce_get_iterator = *pce_get_iterator; + intern-ce_get_iterator = ce_get_iterator; } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject___construct_error1.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject___construct_error1.phpt diff -u php-src/ext/spl/tests/arrayObject___construct_error1.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject___construct_error1.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject___construct_error1.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject___construct_error1.phpt Sun Oct 19 18:00:42 2008 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::__construct with bad iterator. ---XFAIL-- -See bug http://bugs.php.net/bug.php?id=46317 --FILE-- ?php echo Bad iterator type:\n; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u Index: php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt diff -u php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt:1.1.2.1 Fri Oct 17 14:26:35 2008 +++ php-src/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt Sun Oct 19 18:00:42 2008 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::setIteratorClass with bad iterator class. ---XFAIL-- -See bug http://bugs.php.net/bug.php?id=46317 --FILE-- ?php try { @@ -56,4 +54,4 @@ b=2 c=3 string(113) ArrayObject::__construct()
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c
tony2001Sat Oct 18 09:33:21 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c Log: revert the patch, it's not needed in this branch http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.19r2=1.71.2.17.2.20diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.19 php-src/ext/spl/spl_array.c:1.71.2.17.2.20 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.19 Fri Oct 17 22:10:27 2008 +++ php-src/ext/spl/spl_array.c Sat Oct 18 09:33:21 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.19 2008/10/17 22:10:27 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.20 2008/10/18 09:33:21 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1205,8 +1205,6 @@ if (use_arg) { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, z, arg) == FAILURE) { - Z_TYPE_P(tmp) = IS_NULL; - zval_ptr_dtor(tmp); zend_throw_exception(spl_ce_BadMethodCallException, Function expects exactly one argument, 0 TSRMLS_CC); return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c
tony2001Fri Oct 17 22:10:27 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c Log: MFH: fix memleak http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.18r2=1.71.2.17.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.18 php-src/ext/spl/spl_array.c:1.71.2.17.2.19 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.18 Mon Oct 6 13:45:42 2008 +++ php-src/ext/spl/spl_array.c Fri Oct 17 22:10:27 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.18 2008/10/06 13:45:42 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.19 2008/10/17 22:10:27 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1205,6 +1205,8 @@ if (use_arg) { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, z, arg) == FAILURE) { + Z_TYPE_P(tmp) = IS_NULL; + zval_ptr_dtor(tmp); zend_throw_exception(spl_ce_BadMethodCallException, Function expects exactly one argument, 0 TSRMLS_CC); return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests bug46115.phpt
colder Mon Oct 6 13:45:42 2008 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug46115.phpt Modified files: /php-src/ext/splspl_array.c Log: MFH: bug #46115 (Fixes nothing in 5.2, but sync code) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.17r2=1.71.2.17.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.17 php-src/ext/spl/spl_array.c:1.71.2.17.2.18 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.17 Sun Oct 5 14:49:25 2008 +++ php-src/ext/spl/spl_array.c Mon Oct 6 13:45:42 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.17 2008/10/05 14:49:25 colder Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.18 2008/10/06 13:45:42 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1197,6 +1197,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; INIT_PZVAL(tmp); Z_TYPE(tmp) = IS_ARRAY; @@ -1207,9 +1208,12 @@ 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); + } + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } } 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_2) /ext/spl spl_array.c
colder Mon Jul 7 00:02:22 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c Log: Avoid a leak on return_value http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.15r2=1.71.2.17.2.16diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.15 php-src/ext/spl/spl_array.c:1.71.2.17.2.16 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.15 Mon Dec 31 07:20:11 2007 +++ php-src/ext/spl/spl_array.c Mon Jul 7 00:02:22 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.15 2007/12/31 07:20:11 sebastian Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.16 2008/07/07 00:02:22 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1190,9 +1190,9 @@ 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, 2, tmp, arg TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 2, tmp, arg TSRMLS_CC); } else { - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value, 1, tmp, NULL TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 1, tmp, NULL TSRMLS_CC); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c spl_iterators.c /ext/spl/tests bug42654.phpt bug42703.phpt
helly Thu Oct 18 04:49:55 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug42654.phpt bug42703.phpt Modified files: /php-src/ext/splspl_array.c spl_iterators.c Log: - MFB #42654, #42704 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.130r2=1.131diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.130 php-src/ext/spl/spl_array.c:1.131 --- php-src/ext/spl/spl_array.c:1.130 Sun Oct 7 05:15:05 2007 +++ php-src/ext/spl/spl_array.c Thu Oct 18 04:49:54 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.130 2007/10/07 05:15:05 davidw Exp $ */ +/* $Id: spl_array.c,v 1.131 2007/10/18 04:49:54 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1394,7 +1394,7 @@ Create a sub iterator for the current element (same class as $this) */ SPL_METHOD(Array, getChildren) { - zval *object = getThis(), **entry; + zval *object = getThis(), **entry, *flags; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -1416,7 +1416,10 @@ RETURN_ZVAL(*entry, 0, 0); } + MAKE_STD_ZVAL(flags); + ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER); spl_instantiate_arg_ex1(intern-std.ce, return_value, 0, *entry TSRMLS_CC); + zval_ptr_dtor(flags); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.165r2=1.166diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.165 php-src/ext/spl/spl_iterators.c:1.166 --- php-src/ext/spl/spl_iterators.c:1.165 Sun Oct 7 05:15:05 2007 +++ php-src/ext/spl/spl_iterators.c Thu Oct 18 04:49:54 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.165 2007/10/07 05:15:05 davidw Exp $ */ +/* $Id: spl_iterators.c,v 1.166 2007/10/18 04:49:54 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1135,15 +1135,17 @@ spl_dual_it_free(intern TSRMLS_CC); if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) { intern-inner.iterator-funcs-get_current_data(intern-inner.iterator, data TSRMLS_CC); - intern-current.data = *data; - Z_ADDREF_P(intern-current.data); + if (data *data) { + intern-current.data = *data; + Z_ADDREF_P(intern-current.data); + } if (intern-inner.iterator-funcs-get_current_key) { intern-current.key_type = intern-inner.iterator-funcs-get_current_key(intern-inner.iterator, intern-current.str_key, intern-current.str_key_len, intern-current.int_key TSRMLS_CC); } else { intern-current.key_type = HASH_KEY_IS_LONG; intern-current.int_key = intern-current.pos; } - return SUCCESS; + return EG(exception) ? FAILURE : SUCCESS; } return FAILURE; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42654.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug42654.phpt +++ php-src/ext/spl/tests/bug42654.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42703.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug42703.phpt +++ php-src/ext/spl/tests/bug42703.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_2) /ext/spl spl_array.c spl_iterators.c /ext/spl/tests bug41692.phpt bug42654.phpt
helly Thu Oct 18 05:26:55 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c spl_iterators.c /php-src/ext/spl/tests bug41692.phpt bug42654.phpt Log: - MF53 Fix for #41692, #42703 # Now in correct branch with fixed checkout and so on http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13r2=1.71.2.17.2.14diff_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 php-src/ext/spl/spl_array.c:1.71.2.17.2.14 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13 Fri Jul 20 10:53:56 2007 +++ php-src/ext/spl/spl_array.c Thu Oct 18 05:26:55 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13 2007/07/20 10:53:56 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.14 2007/10/18 05:26:55 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1365,7 +1365,7 @@ Create a sub iterator for the current element (same class as $this) */ SPL_METHOD(Array, getChildren) { - zval *object = getThis(), **entry; + zval *object = getThis(), **entry, *flags; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -1387,7 +1387,10 @@ RETURN_ZVAL(*entry, 0, 0); } - spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), return_value, 0, *entry TSRMLS_CC); + MAKE_STD_ZVAL(flags); + ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER); + spl_instantiate_arg_ex2(intern-std.ce, return_value, 0, *entry, flags TSRMLS_CC); + zval_ptr_dtor(flags); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28r2=1.73.2.30.2.29diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.29 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28 Fri May 11 00:15:25 2007 +++ php-src/ext/spl/spl_iterators.c Thu Oct 18 05:26:55 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.28 2007/05/11 00:15:25 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.29 2007/10/18 05:26:55 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1124,15 +1124,17 @@ spl_dual_it_free(intern TSRMLS_CC); if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) { intern-inner.iterator-funcs-get_current_data(intern-inner.iterator, data TSRMLS_CC); - intern-current.data = *data; - intern-current.data-refcount++; + if (data *data) { + intern-current.data = *data; + intern-current.data-refcount++; + } if (intern-inner.iterator-funcs-get_current_key) { intern-current.key_type = intern-inner.iterator-funcs-get_current_key(intern-inner.iterator, intern-current.str_key, intern-current.str_key_len, intern-current.int_key TSRMLS_CC); } else { intern-current.key_type = HASH_KEY_IS_LONG; intern-current.int_key = intern-current.pos; } - return SUCCESS; + return EG(exception) ? FAILURE : SUCCESS; } return FAILURE; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41692.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u Index: php-src/ext/spl/tests/bug41692.phpt diff -u php-src/ext/spl/tests/bug41692.phpt:1.1.2.3 php-src/ext/spl/tests/bug41692.phpt:1.1.2.4 --- php-src/ext/spl/tests/bug41692.phpt:1.1.2.3 Thu Oct 18 04:51:53 2007 +++ php-src/ext/spl/tests/bug41692.phpt Thu Oct 18 05:26:55 2007 @@ -21,44 +21,20 @@ echo Done\n; ? --EXPECTF-- -object(Bar)#%d (2) { - [foo:Bar:private]= - array(3) { -[0]= -int(1) -[1]= -int(2) -[2]= -int(3) - } - [storage:ArrayObject:private]= - array(3) { -[0]= -int(1) -[1]= -int(2) -[2]= -int(3) - } +object(Bar)#%d (3) { + [0]= + int(1) + [1]= + int(2) + [2]= + int(3) } -object(Bar)#%d (2) { - [foo:Bar:private]= - array(3) { -[0]= -int(1) -[1]= -int(2) -[2]= -int(3) - } - [storage:ArrayObject:private]= - array(3) { -[0]= -int(1) -[1]= -int(2) -[2]= -int(3) - } +object(Bar)#%d (3) { + [0]= + int(1) + [1]= + int(2) + [2]= + int(3) } Done http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42654.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u Index: php-src/ext/spl/tests/bug42654.phpt diff -u php-src/ext/spl/tests/bug42654.phpt:1.1.4.2 php-src/ext/spl/tests/bug42654.phpt:1.1.4.3 --- php-src/ext/spl/tests/bug42654.phpt:1.1.4.2 Thu Oct 18 04:49:55 2007 +++ php-src/ext/spl/tests/bug42654.phpt Thu Oct 18 05:26:55 2007 @@ -23,47
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c /ext/spl/tests bug40442.phpt
helly Fri Apr 6 15:32:29 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug40442.phpt Modified files: /php-src/ext/splspl_array.c Log: - Fix #40442 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.123r2=1.124diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.123 php-src/ext/spl/spl_array.c:1.124 --- php-src/ext/spl/spl_array.c:1.123 Sat Mar 24 16:28:45 2007 +++ php-src/ext/spl/spl_array.c Fri Apr 6 15:32:29 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.123 2007/03/24 16:28:45 helly Exp $ */ +/* $Id: spl_array.c,v 1.124 2007/04/06 15:32:29 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -525,7 +525,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, index) == FAILURE) { return; } - RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 1 TSRMLS_CC)); + RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 0 TSRMLS_CC)); } /* }}} */ /* {{{ proto mixed ArrayObject::offsetGet(mixed $index) U http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40442.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug40442.phpt +++ php-src/ext/spl/tests/bug40442.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_2) /ext/spl spl_array.c
helly Sat Mar 24 16:28:53 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c Log: - MFH Drop double variable declaration http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.9r2=1.71.2.17.2.10diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.9 php-src/ext/spl/spl_array.c:1.71.2.17.2.10 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.9 Tue Mar 20 20:28:08 2007 +++ php-src/ext/spl/spl_array.c Sat Mar 24 16:28:53 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.9 2007/03/20 20:28:08 helly Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.10 2007/03/24 16:28:53 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -492,7 +492,6 @@ index = Z_LVAL_P(offset); } if (check_empty) { - zval **tmp; HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (zend_hash_index_find(ht, index, (void **)tmp) != FAILURE zend_is_true(*tmp)) { return 1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c spl_array.h spl_iterators.c spl_iterators.h
helly Thu Feb 8 22:17:40 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c spl_array.h spl_iterators.c spl_iterators.h Log: - MFH Rearrange code: mode Countable from spl_array.c to spl_iterator.c http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.7r2=1.71.2.17.2.8diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.7 php-src/ext/spl/spl_array.c:1.71.2.17.2.8 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.7 Sun Jan 7 03:52:44 2007 +++ php-src/ext/spl/spl_array.c Thu Feb 8 22:17:40 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.7 2007/01/07 03:52:44 iliaa Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.8 2007/02/08 22:17:40 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -42,8 +42,6 @@ PHPAPI zend_class_entry *spl_ce_ArrayIterator; PHPAPI zend_class_entry *spl_ce_RecursiveArrayIterator; -PHPAPI zend_class_entry *spl_ce_Countable; - #define SPL_ARRAY_STD_PROP_LIST 0x0001 #define SPL_ARRAY_ARRAY_AS_PROPS 0x0002 #define SPL_ARRAY_OVERLOADED_REWIND 0x0001 @@ -1495,11 +1493,6 @@ {NULL, NULL, NULL} }; -static zend_function_entry spl_funcs_Countable[] = { - SPL_ABSTRACT_ME(Countable, count, NULL) - {NULL, NULL, NULL} -}; - /* {{{ PHP_MINIT_FUNCTION(spl_array) */ PHP_MINIT_FUNCTION(spl_array) { @@ -1533,8 +1526,6 @@ REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator-get_iterator = spl_array_get_iterator; - REGISTER_SPL_INTERFACE(Countable); - REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.h?r1=1.13.2.2.2.2r2=1.13.2.2.2.3diff_format=u Index: php-src/ext/spl/spl_array.h diff -u php-src/ext/spl/spl_array.h:1.13.2.2.2.2 php-src/ext/spl/spl_array.h:1.13.2.2.2.3 --- php-src/ext/spl/spl_array.h:1.13.2.2.2.2Mon Jan 1 09:36:07 2007 +++ php-src/ext/spl/spl_array.h Thu Feb 8 22:17:40 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.h,v 1.13.2.2.2.2 2007/01/01 09:36:07 sebastian Exp $ */ +/* $Id: spl_array.h,v 1.13.2.2.2.3 2007/02/08 22:17:40 helly Exp $ */ #ifndef SPL_ARRAY_H #define SPL_ARRAY_H @@ -27,7 +27,6 @@ extern PHPAPI zend_class_entry *spl_ce_ArrayObject; extern PHPAPI zend_class_entry *spl_ce_ArrayIterator; extern PHPAPI zend_class_entry *spl_ce_RecursiveArrayIterator; -extern PHPAPI zend_class_entry *spl_ce_Countable; PHP_MINIT_FUNCTION(spl_array); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.22r2=1.73.2.30.2.23diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.22 php-src/ext/spl/spl_iterators.c:1.73.2.30.2.23 --- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.22 Mon Jan 1 09:36:07 2007 +++ php-src/ext/spl/spl_iterators.c Thu Feb 8 22:17:40 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.73.2.30.2.22 2007/01/01 09:36:07 sebastian Exp $ */ +/* $Id: spl_iterators.c,v 1.73.2.30.2.23 2007/02/08 22:17:40 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -57,6 +57,7 @@ PHPAPI zend_class_entry *spl_ce_AppendIterator; PHPAPI zend_class_entry *spl_ce_RegexIterator; PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator; +PHPAPI zend_class_entry *spl_ce_Countable; zend_function_entry spl_funcs_RecursiveIterator[] = { SPL_ABSTRACT_ME(RecursiveIterator, hasChildren, NULL) @@ -2844,6 +2845,11 @@ {NULL, NULL, NULL} }; +static zend_function_entry spl_funcs_Countable[] = { + SPL_ABSTRACT_ME(Countable, count, NULL) + {NULL, NULL, NULL} +}; + /* {{{ PHP_MINIT_FUNCTION(spl_iterators) */ PHP_MINIT_FUNCTION(spl_iterators) @@ -2886,6 +2892,7 @@ REGISTER_SPL_SUB_CLASS_EX(ParentIterator, RecursiveFilterIterator, spl_dual_it_new, spl_funcs_ParentIterator); + REGISTER_SPL_INTERFACE(Countable); REGISTER_SPL_INTERFACE(SeekableIterator); REGISTER_SPL_ITERATOR(SeekableIterator); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.h?r1=1.18.2.7.2.10r2=1.18.2.7.2.11diff_format=u Index: php-src/ext/spl/spl_iterators.h diff -u php-src/ext/spl/spl_iterators.h:1.18.2.7.2.10 php-src/ext/spl/spl_iterators.h:1.18.2.7.2.11 --- php-src/ext/spl/spl_iterators.h:1.18.2.7.2.10 Mon Jan 1 09:36:07 2007 +++ php-src/ext/spl/spl_iterators.h Thu Feb 8 22:17:40 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.h,v 1.18.2.7.2.10 2007/01/01 09:36:07 sebastian Exp $ */ +/* $Id:
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c
nlopess Fri Aug 11 17:05:23 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c Log: fix #38402: wrong proto for Array*::offsetGet() http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.2r2=1.71.2.17.2.3diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.2 php-src/ext/spl/spl_array.c:1.71.2.17.2.3 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.2 Thu May 11 08:06:22 2006 +++ php-src/ext/spl/spl_array.c Fri Aug 11 17:05:23 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.2 2006/05/11 08:06:22 helly Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.3 2006/08/11 17:05:23 nlopess Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -485,8 +485,8 @@ RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 1 TSRMLS_CC)); } /* }}} */ -/* {{{ proto bool ArrayObject::offsetGet(mixed $index) - proto bool ArrayIterator::offsetGet(mixed $index) +/* {{{ proto mixed ArrayObject::offsetGet(mixed $index) + proto mixed ArrayIterator::offsetGet(mixed $index) Returns the value at the specified $index. */ SPL_METHOD(Array, offsetGet) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl_array.c spl_array.h spl_exceptions.c spl_iterators.c spl_iterators.h
helly Wed May 10 00:03:38 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/splspl_array.c spl_array.h spl_exceptions.c spl_iterators.c spl_iterators.h Log: - Update after api changes - MFH . ArrayIterator/ArrayObject: function lookup caches and array functions . Added RegExIterator, RecursiveRegExIterator . Added (full) caching support for CachingIterator http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17r2=1.71.2.17.2.1diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17 php-src/ext/spl/spl_array.c:1.71.2.17.2.1 --- php-src/ext/spl/spl_array.c:1.71.2.17 Fri Apr 7 22:53:23 2006 +++ php-src/ext/spl/spl_array.c Wed May 10 00:03:38 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17 2006/04/07 22:53:23 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.1 2006/05/10 00:03:38 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -46,10 +46,15 @@ #define SPL_ARRAY_STD_PROP_LIST 0x0001 #define SPL_ARRAY_ARRAY_AS_PROPS 0x0002 +#define SPL_ARRAY_OVERLOADED_REWIND 0x0001 +#define SPL_ARRAY_OVERLOADED_VALID 0x0002 +#define SPL_ARRAY_OVERLOADED_KEY 0x0004 +#define SPL_ARRAY_OVERLOADED_CURRENT 0x0008 +#define SPL_ARRAY_OVERLOADED_NEXT0x0010 #define SPL_ARRAY_IS_REF 0x0100 #define SPL_ARRAY_IS_SELF0x0200 #define SPL_ARRAY_USE_OTHER 0x0400 -#define SPL_ARRAY_INT_MASK 0xFF00 +#define SPL_ARRAY_INT_MASK 0x #define SPL_ARRAY_CLONE_MASK 0x0307 typedef struct _spl_array_object { @@ -114,7 +119,7 @@ } /* }}} */ -zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC); +zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); /* {{{ spl_array_object_new */ 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) @@ -166,6 +171,7 @@ while (parent) { if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator) { retval.handlers = spl_handler_ArrayIterator; + class_type-get_iterator = spl_array_get_iterator; break; } else if (parent == spl_ce_ArrayObject) { retval.handlers = spl_handler_ArrayObject; @@ -195,7 +201,25 @@ intern-fptr_offset_del = NULL; } } - intern-ce_get_iterator = spl_ce_ArrayIterator; + /* Cache iterator functions if ArrayIterator or derived. Check current's */ + /* cache since only current is always required */ + if (retval.handlers == spl_handler_ArrayIterator) { + if (!class_type-iterator_funcs.zf_current) { + zend_hash_find(class_type-function_table, rewind, sizeof(rewind), (void **) class_type-iterator_funcs.zf_rewind); + zend_hash_find(class_type-function_table, valid, sizeof(valid), (void **) class_type-iterator_funcs.zf_valid); + zend_hash_find(class_type-function_table, key, sizeof(key), (void **) class_type-iterator_funcs.zf_key); + zend_hash_find(class_type-function_table, current, sizeof(current), (void **) class_type-iterator_funcs.zf_current); + zend_hash_find(class_type-function_table, next, sizeof(next),(void **) class_type-iterator_funcs.zf_next); + } + if (inherited) { + if (class_type-iterator_funcs.zf_rewind-common.scope != parent) intern-ar_flags |= SPL_ARRAY_OVERLOADED_REWIND; + if (class_type-iterator_funcs.zf_valid-common.scope != parent) intern-ar_flags |= SPL_ARRAY_OVERLOADED_VALID; + if (class_type-iterator_funcs.zf_key-common.scope != parent) intern-ar_flags |= SPL_ARRAY_OVERLOADED_KEY; + if (class_type-iterator_funcs.zf_current-common.scope != parent) intern-ar_flags |= SPL_ARRAY_OVERLOADED_CURRENT; + if (class_type-iterator_funcs.zf_next-common.scope != parent) intern-ar_flags |= SPL_ARRAY_OVERLOADED_NEXT; + } + } + zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), intern-pos); return retval; } @@ -659,7 +683,7 @@ /* define an overloaded iterator structure */ typedef struct { - zend_object_iterator intern; + zend_user_iteratorintern; spl_array_object *object; } spl_array_it; @@ -667,7 +691,8 @@ { spl_array_it *iterator = (spl_array_it *)iter; -