summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Kneuss <colder@php.net>2009-02-03 12:54:44 +0000
committerEtienne Kneuss <colder@php.net>2009-02-03 12:54:44 +0000
commitff334d32f652d36c6b3930a4d2d247c78aceb409 (patch)
tree5311dd6964656007445f4927d0251e196f908208
parent384f89f85e2112e853b1b93c40f89c92904c7641 (diff)
downloadphp-git-ff334d32f652d36c6b3930a4d2d247c78aceb409.tar.gz
MFH: Fix #47031 (Fix constants in example)
-rw-r--r--NEWS1
-rwxr-xr-xext/spl/examples/dualiterator.inc15
2 files changed, 7 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 1d53965918..ffe0b3b744 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? ??? 2009, PHP 5.3.0 Beta 2
- Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno)
- Fixed bug #46347 (parse_ini_file() doesn't support * in keys). (Nuno)
+- Fixed bug #47031 (Fix constants in DualIterator example). (Etienne)
29 Jan 2009, PHP 5.3.0 Beta 1
diff --git a/ext/spl/examples/dualiterator.inc b/ext/spl/examples/dualiterator.inc
index 9d14328d74..4cee203436 100755
--- a/ext/spl/examples/dualiterator.inc
+++ b/ext/spl/examples/dualiterator.inc
@@ -23,10 +23,9 @@ class DualIterator implements Iterator
const KEY_LHS = 0x10;
const KEY_RHS = 0x20;
- const KEY_ARRAY = 0x30;
const KEY_0 = 0x00;
- const DEFAULT_FLAGS = 0x33;
+ const DEFAULT_FLAGS = 0x13;
private $lhs;
private $rhs;
@@ -39,7 +38,7 @@ class DualIterator implements Iterator
* @param flags iteration flags
*/
function __construct(Iterator $lhs, Iterator $rhs,
- $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
+ $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
{
$this->lhs = $lhs;
$this->rhs = $rhs;
@@ -107,20 +106,18 @@ class DualIterator implements Iterator
}
}
- /** @return current value depending on KEY_* flags
+ /** @return key value depending on KEY_* flags
*/
function key()
{
switch($this->flags & 0xF0)
{
default:
- case self::CURRENT_ARRAY:
- return array($this->lhs->key(), $this->rhs->key());
- case self::CURRENT_LHS:
+ case self::KEY_LHS:
return $this->lhs->key();
- case self::CURRENT_RHS:
+ case self::KEY_RHS:
return $this->rhs->key();
- case self::CURRENT_0:
+ case self::KEY_0:
return NULL;
}
}