mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
Revert "EmptyIterator now implements Countable; fixes bug 60577"
This reverts commit 8a936e8eb9
.
This commit is contained in:
parent
7e9044b6a2
commit
7a24ee13ec
4 changed files with 2 additions and 34 deletions
3
NEWS
3
NEWS
|
@ -15,9 +15,6 @@ PHP NEWS
|
||||||
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
|
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
|
||||||
(Syra)
|
(Syra)
|
||||||
|
|
||||||
- SPL:
|
|
||||||
. Fixed bug #60577 (count(new EmptyIterator) returns 1). (Levi Morrison)
|
|
||||||
|
|
||||||
?? ??? 2013, PHP 5.4.20
|
?? ??? 2013, PHP 5.4.20
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @since PHP 5.1
|
* @since PHP 5.1
|
||||||
*/
|
*/
|
||||||
class EmptyIterator implements Iterator, Countable
|
class EmptyIterator implements Iterator
|
||||||
{
|
{
|
||||||
/** No operation.
|
/** No operation.
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -57,15 +57,6 @@ class EmptyIterator implements Iterator, Countable
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function count()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -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[] = {
|
static const zend_function_entry spl_funcs_EmptyIterator[] = {
|
||||||
SPL_ME(EmptyIterator, rewind, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
|
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, valid, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
|
||||||
SPL_ME(EmptyIterator, key, 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, current, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
|
||||||
SPL_ME(EmptyIterator, next, 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
|
PHP_FE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3767,7 +3756,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
|
||||||
|
|
||||||
REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
|
REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
|
||||||
REGISTER_SPL_ITERATOR(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_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator);
|
||||||
REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT);
|
REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT);
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
--TEST--
|
|
||||||
count(new EmptyIterator) should return zero
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
$it = new EmptyIterator;
|
|
||||||
var_dump(count($it));
|
|
||||||
--EXPECT--
|
|
||||||
int(0)
|
|
Loading…
Add table
Add a link
Reference in a new issue