#35435 [Fbk]: PDO::query is not returning a PDOStatement object
| From: | wez@php.net | Date: | Sun, 27 Nov 2005 23:50:28 +0000 |
| Subject: | #35435 [Fbk]: PDO::query is not returning a PDOStatement object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89145@lists.php.net to get a copy of this message | ||
ID: 35435
Updated by: wez@php.net
Reported By: bugs at jth dot net
Status: Feedback
Bug Type: Reproducible crash
Operating System: Linux Fedora 3
PHP Version: 5.1.0
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
You have no error handling code in your script.
Try also setting this before issuing queries:
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
If you're getting segfaults, we need a backtrace.
Try the latest snapshot, and please provide us with a backtrace.
Previous Comments:
------------------------------------------------------------------------
[2005-11-28 00:18:56] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-11-28 00:05:41] bugs at jth dot net
Description:
------------
PDO::query is not returning a PDOStatement object.
and segmentation fault using array(PDO::ATTR_PERSISTENT => true)
mysqld Ver 5.0.15-standard for pc-linux-gnu on i686
Server version: Apache/2.0.54
Architecture: 32-bit
Reproduce code:
---------------
try {
$dbh = new PDO('mysql:host=localhost;dbname=ddddd', "xxxxx",
"xxxxxxx");
$query = "SELECT COUNT(*) FROM ordrer";
$stmt = $dbh->query($query);
//$stmt = $dbh->prepare($query); $result = $stmt->execute();
print $stmt->columnCount();
} catch (PDOException $e) {
print "Error !: " . $e->getMessage() . "<br/>";
die();
}
Actual result:
--------------
$stmt = $dbh->query($query);
Call to a member function columnCount() on a non-object
when executing code print $stmt->columnCount() but not after
$stmt = $dbh->prepare($query); $result = $stmt->execute();
However,
Apache2 child pid 22634 exit signal Segmentation fault (11)
in any case when using array(PDO::ATTR_PERSISTENT => true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35435&edit=1