Doc #68993 [Opn]: Inconsistency in documentations of list-intrinsic.

From: Date: Thu, 05 Feb 2015 16:03:49 +0000
Subject: Doc #68993 [Opn]: Inconsistency in documentations of list-intrinsic.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11926@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68993&edit=1

 ID:                 68993
 Updated by:         datibbaw@php.net
 Reported by:        minecraftshamrock at gmail dot com
 Summary:            Inconsistency in documentations of list-intrinsic.
 Status:             Open
 Type:               Documentation Problem
 Package:            PHP Language Specification
 PHP Version:        master-Git-2015-02-05 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

A change for this has been proposed a month ago:

https://github.com/php/php-langspec/pull/111


Previous Comments:
------------------------------------------------------------------------
[2015-02-05 13:18:06] minecraftshamrock at gmail dot com

Description:
------------
Original question on StackOverflow: https://stackoverflow.com/q/28343884/2324078


I saw the list-intrinsic specification
(https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#list), which states that for
a list-intrinsic construct, the right-hand side of the simple-assignment-expression must be an
expression that designates an array.

But the documentation of list from php.net (http://php.net/manual/en/function.list.php), gives an
example like the one in the attached test script of this ticket.

The thing is that PDOStatement::fetch(PDO::FETCH_NUM) returns FALSE if there is no further row. But
the right-hand side of the assignment-expression must be an array - and FALSE is not an array. So
this would result in a fatal-error, right?

Have I missed something, or is this really an inconsistency?

Test script:
---------------
$result = $pdo->query("SELECT id, name, salary FROM employees");
while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {
    //output $id, $name and $salary
}



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68993&edit=1


Thread (3 messages)

« previous php.doc.bugs (#11926) next »