helly Mon Oct 10 20:18:33 2005 EDT
Modified files:
/php-src/ext/spl spl_iterators.c spl_iterators.h
/php-src/ext/spl/tests iterator_029.phpt
Log:
- Provide const RegExIterator::USE_KEY and actually use it in the test
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.90&r2=1.91&ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.90
php-src/ext/spl/spl_iterators.c:1.91
--- php-src/ext/spl/spl_iterators.c:1.90 Mon Oct 10 19:58:40 2005
+++ php-src/ext/spl/spl_iterators.c Mon Oct 10 20:18:31 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.90 2005/10/10 23:58:40 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.91 2005/10/11 00:18:31 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1268,7 +1268,7 @@
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis()
TSRMLS_CC);
- if (intern->u.regex.flags) {
+ if (intern->u.regex.flags & REGIT_USE_KEY) {
if (intern->current.key_type == HASH_KEY_IS_LONG) {
subject_len = snprintf(tmp, sizeof(tmp), "%ld",
intern->current.int_key);
subject = &tmp[0];
@@ -2434,6 +2434,7 @@
REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator,
spl_dual_it_new, spl_funcs_InfiniteIterator);
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
REGISTER_SPL_SUB_CLASS_EX(RegExIterator, FilterIterator,
spl_dual_it_new, spl_funcs_RegExIterator);
+ REGISTER_SPL_CLASS_CONST_LONG(RegExIterator, "USE_KEY", REGIT_USE_KEY);
REGISTER_SPL_SUB_CLASS_EX(RecursiveRegExIterator, RegExIterator,
spl_dual_it_new, spl_funcs_RecursiveRegExIterator);
REGISTER_SPL_IMPLEMENTS(RecursiveRegExIterator, RecursiveIterator);
#else
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.h?r1=1.25&r2=1.26&ty=u
Index: php-src/ext/spl/spl_iterators.h
diff -u php-src/ext/spl/spl_iterators.h:1.25
php-src/ext/spl/spl_iterators.h:1.26
--- php-src/ext/spl/spl_iterators.h:1.25 Mon Oct 10 19:58:40 2005
+++ php-src/ext/spl/spl_iterators.h Mon Oct 10 20:18:31 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.h,v 1.25 2005/10/10 23:58:40 helly Exp $ */
+/* $Id: spl_iterators.h,v 1.26 2005/10/11 00:18:31 helly Exp $ */
#ifndef SPL_ITERATORS_H
#define SPL_ITERATORS_H
@@ -85,6 +85,11 @@
CIT_HAS_CHILDREN = 0x00020000
};
+enum {
+ /* public */
+ REGIT_USE_KEY = 0x00000001,
+};
+
typedef struct _spl_dual_it_object {
zend_object std;
struct {
http://cvs.php.net/diff.php/php-src/ext/spl/tests/iterator_029.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/spl/tests/iterator_029.phpt
diff -u php-src/ext/spl/tests/iterator_029.phpt:1.1
php-src/ext/spl/tests/iterator_029.phpt:1.2
--- php-src/ext/spl/tests/iterator_029.phpt:1.1 Mon Oct 10 19:58:42 2005
+++ php-src/ext/spl/tests/iterator_029.phpt Mon Oct 10 20:18:32 2005
@@ -5,7 +5,7 @@
$ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42);
-foreach(new RegExIterator(new ArrayIterator($ar), "/2/", 0) as $k => $v)
+foreach(new RegExIterator(new ArrayIterator($ar), "/2/") as $k => $v)
{
echo "$k=>$v\n";
}
@@ -14,7 +14,7 @@
===KEY===
<?php
-foreach(new RegExIterator(new ArrayIterator($ar), "/2/", 0) as $k => $v)
+foreach(new RegExIterator(new ArrayIterator($ar), "/2/",
RegExIterator::USE_KEY) as $k => $v)
{
echo "$k=>$v\n";
}
@@ -29,9 +29,10 @@
24=>22
25=>42
===KEY===
-1=>123
2=>123
+22=>abc
23=>a2b
24=>22
+a2d=>7
25=>42
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php