#50169 [NEW]: PDO::query
| From: | milosdj at gmail dot com | Date: | Fri, 13 Nov 2009 18:56:49 +0000 |
| Subject: | #50169 [NEW]: PDO::query | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-3109@lists.php.net to get a copy of this message | ||
From: milosdj at gmail dot com
Operating system: all
PHP version: 5.3.0
PHP Bug Type: Documentation problem
Bug description: PDO::query
Description:
------------
Documentation states:
Return Values
PDO::query() returns a PDOStatement object.
Witch absolutely is not true for mysql!
if(PDO::ATTR_ERRMODE=0){PDO::query() will return FALSE;}
if(PDO::ATTR_ERRMODE=1){PDO::query() will return FALSE;}
if(PDO::ATTR_ERRMODE=3){PDO::query() will return PDOStatement object;}
So either change PDO::query() function to always return PDOStatement
object or add two sentences in PHP PDO documentation.
Reproduce code:
---------------
$db=new PDO($dsn,$user,$pass,array(PDO::ATTR_ERRMODE=>0)); // or =>1
$sql='SELECT * from tblName';
$result= $db->query($sql); // as object
if($result==false){die('Look it actually is false!!!');}
Expected result:
----------------
What documentation states. ALWAYS PDOStatement!
Please fix documentation.
Actual result:
--------------
if PDO::ERRMODE_SILENT $result is false
if PDO::ERRMODE_WARNING $result is false
if PDO::ERRMODE_EXCEPTION $result is PDOStatement
--
Edit bug report at http://bugs.php.net/?id=50169&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50169&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50169&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50169&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50169&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50169&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50169&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50169&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50169&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50169&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50169&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50169&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50169&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50169&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50169&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50169&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50169&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50169&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50169&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50169&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50169&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50169&r=mysqlcfg