Doc #53624 [Asn->Csd]: NULL also works for $row
| From: | aharvey@php.net | Date: | Tue, 04 Jan 2011 14:37:03 +0000 |
| Subject: | Doc #53624 [Asn->Csd]: NULL also works for $row | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5747@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53624&edit=1
ID: 53624
Updated by: aharvey@php.net
Reported by: jsnell at e-normous dot com
Summary: NULL also works for $row
-Status: Assigned
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: 5.3.4
Assigned To: aharvey
Block user comment: N
Private report: N
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:
------------------------------------------------------------------------
[2011-01-04 15:36:54] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=307084
Log: Fix doc bug #53624 (NULL also works for $row).
------------------------------------------------------------------------
[2010-12-28 19:34:49] jsnell at e-normous dot com
Description:
------------
---
From manual page: http://www.php.net/function.pg-fetch-assoc#Parameters
---
The documentation should be updated to reflect that supplying null for
$row will return the next result.
IMO, the copy text for $row in the documentation should read:
"Row number in result to fetch. Rows are numbered from 0 upwards. If
omitted or null, next row is fetched. "
Without this in the documentation, one may expect that supply null would
do any one of the following things:
a) be treated as integer 0, as (int) null === 0, and always return the
first row
b) result in an error/warning for supplying a value which is not
accepted according to the documentation
c) the actual behavior, of fetching the next row
Test script:
---------------
$conn = pg_connect(...);
$result = pg_query('select 1');
$row1 = pg_fetch_assoc($result, null);
$row2 = pg_fetch_assoc($result, null);
Expected result:
----------------
null would be cast to an integer of 0 (since (int) null === 0),
resulting in $row1 and $row2 both containing the same row.
OR documentation would state that null will give you the next result.
Actual result:
--------------
Fetching $row2 will fail, as there is only 1 result.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53624&edit=1