#36788 [NEW]: prepared statements broken
| From: | bubblenut at gmail dot com | Date: | Sun, 19 Mar 2006 15:00:21 +0000 |
| Subject: | #36788 [NEW]: prepared statements broken | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-94559@lists.php.net to get a copy of this message | ||
From: bubblenut at gmail dot com
Operating system: Linux 2.6.12 (Kubuntu)
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: prepared statements broken
Description:
------------
It works fine on my Debian Sarge machine but on my Kubuntu laptop it
fails.
I have tried it with the follwing releases
PHP 5.1.0 CVS
PHP 5.1.1
PHP 5.1.2
PHP 5.1.2 CVS
Reproduce code:
---------------
<?php
//phpinfo();
$db = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT id FROM recipe WHERE id=?");
$stmt->bindValue(1, 1);
$stmt->execute();
$res = $stmt->fetch();
var_dump($res);
$stmt = $db->prepare("SELECT id FROM recipe WHERE id=1");
$res = $stmt->fetch();
var_dump($res);
foreach($db->query("SELECT id FROM recipe WHERE id=1") as $res) {
var_dump($res);
}
Expected result:
----------------
array(2) {
["id"]=>
string(1) "1"
[0]=>
string(1) "1"
}
array(2) {
["id"]=>
string(1) "1"
[0]=>
string(1) "1"
}
array(2) {
["id"]=>
string(1) "1"
[0]=>
string(1) "1"
}
Actual result:
--------------
bool(false)
bool(false)
array(2) {
["id"]=>
string(1) "1"
[0]=>
string(1) "1"
}
--
Edit bug report at http://bugs.php.net/?id=36788&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36788&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36788&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36788&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36788&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36788&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36788&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36788&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36788&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36788&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36788&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36788&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36788&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36788&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36788&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36788&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36788&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36788&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36788&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36788&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36788&r=mysqlcfg