#35793 [Com]: General error: 2050
| From: | email at steffenweber dot net | Date: | Mon, 17 Apr 2006 16:56:31 +0000 |
| Subject: | #35793 [Com]: General error: 2050 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95888@lists.php.net to get a copy of this message | ||
ID: 35793
Comment by: email at steffenweber dot net
Reported By: deadman_great at mail dot ru
Status: No Feedback
Bug Type: PDO related
Operating System: RH Fedora Core 2
PHP Version: 5CVS-2005-12-25 (snap)
Assigned To: Wez
New Comment:
You must be kidding? :-(
Previous Comments:
------------------------------------------------------------------------
[2006-04-17 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-04-09 15:31:01] email at steffenweber dot net
I´ve tried php5.1-200604091430.tar.bz2 and the error is still there.
------------------------------------------------------------------------
[2006-04-09 07:39:25] wez@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
Try the next snapshot dated after this message.
------------------------------------------------------------------------
[2006-03-23 00:25:26] qlogix at gmail dot com
I can confirm the statement on Centos 4.1, PHP 5.1.2, Mysql 4.1.16
"You cannot use the same variable for a PDOStatement object twice. As
others have pointed out it works when you set this variable to null in
between."
<?php
$db = new PDO(SQL_DSN,SQL_USER,SQL_PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$result = $db->query('SELECT COUNT(*) FROM Locations');
echo $result."<br>";
$row = $result->fetchAll(PDO::FETCH_ASSOC);
/* Comment the next line out and script returns an error */
//$result = null;
$result = $db->query('SELECT COUNT(*) FROM Accounts');
echo $result."<br>";
$row = $result->fetch(PDO::FETCH_ASSOC); /* This line causes the error
*/
?>
With line "$result = null;" commented out:
Object id #2
Object id #3
PDOException Object
(
[message:protected] => SQLSTATE[HY000]: General error: 2050
With line "$result = null;" not commented out:
Object id #2
Object id #2
No error message (script works)
------------------------------------------------------------------------
[2006-03-21 18:37:15] email at steffenweber dot net
I can confirm that this error does not occur on Windows XP + PHP 5.1.2
+ MySQL 5.0.18. It does happen for me on Gentoo Linux + PHP 5.1.2 +
MySQL 4.1.16.
You cannot use the same variable for a PDOStatement object twice. As
others have pointed out it works when you set this variable to null in
between.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35793
--
Edit this bug report at http://bugs.php.net/?id=35793&edit=1