Doc #51177 [Opn->Csd]: Iterator::key() return value should not say "integer 0 on failure"
| From: | degeberg@php.net | Date: | Sat, 06 Mar 2010 13:31:31 +0000 |
| Subject: | Doc #51177 [Opn->Csd]: Iterator::key() return value should not say "integer 0 on failure" | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4017@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51177&edit=1
ID: 51177
Updated by: degeberg@php.net
Reported by: david dot h at highgearmedia dot com
Summary: Iterator::key() return value should not say "integer 0
on failure"
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: n/a
PHP Version: 5.3.2RC3
Assigned To: degeberg
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2010-03-06 14:31:16] degeberg@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=295890
Log: Fixed PHP bug #51177 (Iterator::key() return value should not say
"integer 0 on failure")
------------------------------------------------------------------------
[2010-03-01 22:06:26] david dot h at highgearmedia dot com
Description:
------------
The documentation for the return value of Iterator::key() states that it
will be integer 0 on failure.
1. The docs also state that an E_WARNING will be issued. This is
probably the only correct response.
2. Integer 0 is a valid key for an iterator so it should not be used as
an error signal value.
Test script:
---------------
<?php
$x = array();
$x[] = 'zero';
$x[] = 'one';
$obj = new ArrayObject($x);
$iter = $obj->getIterator();
echo $iter->key() . PHP_EOL;
echo $iter->current() . PHP_EOL;
?>
Expected result:
----------------
0
zero
Actual result:
--------------
0
zero
[Correct output, but it doesn't match the docs since key() is not
returning an error but it is returning 0.]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51177&edit=1