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

From: Date: Thu, 05 Feb 2015 13:18:07 +0000
Subject: Doc #68993 [NEW]: Inconsistency in documentations of list-intrinsic.
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11925@lists.php.net to get a copy of this message
From:             minecraftshamrock at gmail dot com
Operating system: 
PHP version:      master-Git-2015-02-05 (Git)
Package:          PHP Language Specification
Bug Type:         Documentation Problem
Bug description:Inconsistency in documentations of list-intrinsic.

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 bug report at https://bugs.php.net/bug.php?id=68993&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=68993&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=68993&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=68993&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=68993&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=68993&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=68993&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=68993&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=68993&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=68993&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=68993&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=68993&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=68993&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=68993&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68993&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=68993&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=68993&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=68993&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68993&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=68993&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=68993&r=mysqlcfg



Thread (3 messages)

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