Skip to content

Commit ff334d3

Browse files
committed
MFH: Fix #47031 (Fix constants in example)
1 parent 384f89f commit ff334d3

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2009, PHP 5.3.0 Beta 2
44
- Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno)
55
- Fixed bug #46347 (parse_ini_file() doesn't support * in keys). (Nuno)
6+
- Fixed bug #47031 (Fix constants in DualIterator example). (Etienne)
67

78

89
29 Jan 2009, PHP 5.3.0 Beta 1

ext/spl/examples/dualiterator.inc

+6-9
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ class DualIterator implements Iterator
2323

2424
const KEY_LHS = 0x10;
2525
const KEY_RHS = 0x20;
26-
const KEY_ARRAY = 0x30;
2726
const KEY_0 = 0x00;
2827

29-
const DEFAULT_FLAGS = 0x33;
28+
const DEFAULT_FLAGS = 0x13;
3029

3130
private $lhs;
3231
private $rhs;
@@ -39,7 +38,7 @@ class DualIterator implements Iterator
3938
* @param flags iteration flags
4039
*/
4140
function __construct(Iterator $lhs, Iterator $rhs,
42-
$flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
41+
$flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
4342
{
4443
$this->lhs = $lhs;
4544
$this->rhs = $rhs;
@@ -107,20 +106,18 @@ class DualIterator implements Iterator
107106
}
108107
}
109108

110-
/** @return current value depending on KEY_* flags
109+
/** @return key value depending on KEY_* flags
111110
*/
112111
function key()
113112
{
114113
switch($this->flags & 0xF0)
115114
{
116115
default:
117-
case self::CURRENT_ARRAY:
118-
return array($this->lhs->key(), $this->rhs->key());
119-
case self::CURRENT_LHS:
116+
case self::KEY_LHS:
120117
return $this->lhs->key();
121-
case self::CURRENT_RHS:
118+
case self::KEY_RHS:
122119
return $this->rhs->key();
123-
case self::CURRENT_0:
120+
case self::KEY_0:
124121
return NULL;
125122
}
126123
}

0 commit comments

Comments
 (0)