From: jan_metzel at gmx dot de
Operating system: Linux
PHP version: 5.1.6
PHP Bug Type: PDO related
Bug description: parameter substitution:parameters always empty
Description:
------------
Parameter substitution in PDO::prepare() does not work.
Statement has been executed successfully but it seems like
values of parameters are just empty strings.
Seems to occure no matter what kind of query is used
(SELECT, INSERT, DELETE, ...).
gentoo-linux ~x86
gcc-4.1.1
mysql-4.1.21
apache-2.0.59
php-5.1.6 (r6) (gentoo)
php5.2-200610201630 (php.net snapshot)
Strange:
On an other box with almost the same software the bug does
not occure (gcc-3.4.3 (!), mysql-4.1.21, apache-2.0.59,
php-5.1.6 (r6))
Reproduce code:
---------------
<?php
$conn = new PDO('mysql:host=localhost;dbname=test', 'root',
'extremlysecret');
$conn->query('CREATE TABLE IF NOT EXISTS `dummy` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`foo` VARCHAR( 64 ) NOT NULL
) ENGINE = MYISAM');
$ps = $conn->prepare("INSERT INTO dummy (foo) VALUES (?)");
$ps->execute(array('first try'));
$ps = $conn->prepare("INSERT INTO dummy (foo) VALUES (:val)");
$val = 'second try';
$ps->bindParam(':val', $val);
$ps->execute();
$ps = $conn->exec("INSERT INTO dummy (foo) VALUES ('this is lame but
works')");
print_r($conn->query('SELECT * FROM dummy')->fetchAll(PDO::FETCH_OBJ));
?>
Expected result:
----------------
Array
(
[0] => stdClass Object
(
[id] => 1
[foo] => first try
)
[1] => stdClass Object
(
[id] => 2
[foo] => second try
)
[2] => stdClass Object
(
[id] => 3
[foo] => this is lame but works
)
)
Actual result:
--------------
Array
(
[0] => stdClass Object
(
[id] => 1
[foo] =>
)
[1] => stdClass Object
(
[id] => 2
[foo] =>
)
[2] => stdClass Object
(
[id] => 3
[foo] => this is lame but works
)
)
--
Edit bug report at http://bugs.php.net/?id=39218&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39218&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39218&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39218&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39218&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39218&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39218&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39218&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39218&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39218&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39218&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39218&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39218&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39218&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39218&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39218&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39218&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39218&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39218&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39218&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39218&r=mysqlcfg