summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Soria Parra <dsp@php.net>2013-09-18 15:06:19 +0200
committerDavid Soria Parra <dsp@php.net>2013-09-18 15:06:36 +0200
commit7a24ee13ec74bf3e85970e59dd69db8034ff434c (patch)
tree047a7e85353034be8dde0ee86b374e0f6e568411
parent7e9044b6a251f40da1217c3265b83a9caae8bff8 (diff)
downloadphp-git-7a24ee13ec74bf3e85970e59dd69db8034ff434c.tar.gz
Revert "EmptyIterator now implements Countable; fixes bug 60577"
This reverts commit 8a936e8eb938965b0daaf076c109ec60141e57a7.
-rw-r--r--NEWS3
-rw-r--r--ext/spl/internal/emptyiterator.inc13
-rw-r--r--ext/spl/spl_iterators.c12
-rw-r--r--ext/spl/tests/bug60577.phpt8
4 files changed, 2 insertions, 34 deletions
diff --git a/NEWS b/NEWS
index d8895bdfde..6d94980fbc 100644
--- a/NEWS
+++ b/NEWS
@@ -15,9 +15,6 @@ PHP NEWS
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
(Syra)
-- SPL:
- . Fixed bug #60577 (count(new EmptyIterator) returns 1). (Levi Morrison)
-
?? ??? 2013, PHP 5.4.20
- Core:
diff --git a/ext/spl/internal/emptyiterator.inc b/ext/spl/internal/emptyiterator.inc
index d02b15b999..ac80e79581 100644
--- a/ext/spl/internal/emptyiterator.inc
+++ b/ext/spl/internal/emptyiterator.inc
@@ -15,7 +15,7 @@
* @version 1.0
* @since PHP 5.1
*/
-class EmptyIterator implements Iterator, Countable
+class EmptyIterator implements Iterator
{
/** No operation.
* @return void
@@ -57,15 +57,6 @@ class EmptyIterator implements Iterator, Countable
{
// nothing to do
}
-
- /**
- * @return int
- */
- function count()
- {
- return 0;
- }
-
}
-?>
+?> \ No newline at end of file
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index ad76258413..eb8247654e 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -3279,23 +3279,12 @@ SPL_METHOD(EmptyIterator, next)
}
} /* }}} */
-/* {{{ proto int EmptyIterator::count()
- Does nothing */
-SPL_METHOD(EmptyIterator, count)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_LONG(0);
-} /* }}} */
-
static const zend_function_entry spl_funcs_EmptyIterator[] = {
SPL_ME(EmptyIterator, rewind, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(EmptyIterator, valid, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(EmptyIterator, key, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(EmptyIterator, current, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(EmptyIterator, next, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
- SPL_ME(EmptyIterator, count, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -3767,7 +3756,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
REGISTER_SPL_ITERATOR(EmptyIterator);
- REGISTER_SPL_IMPLEMENTS(EmptyIterator, Countable);
REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT);
diff --git a/ext/spl/tests/bug60577.phpt b/ext/spl/tests/bug60577.phpt
deleted file mode 100644
index 33fc133d0f..0000000000
--- a/ext/spl/tests/bug60577.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-count(new EmptyIterator) should return zero
---FILE--
-<?php
-$it = new EmptyIterator;
-var_dump(count($it));
---EXPECT--
-int(0)