#39218 [Opn->Bgs]: parameter substitution:parameters always empty
ID: 39218
Updated by: tony2001@php.net
Reported By: jan_metzel at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: Linux
PHP Version: 5.1.6
New Comment:
Then it's apparently not PHP problem.
Previous Comments:
------------------------------------------------------------------------
[2006-10-21 12:24:15] jan_metzel at gmx dot de
Yes, yesterday I already tested the latest snapshot
php5.2-200610201630
didn't fix it.
May the combination of gcc4 and mysql4 cause the problem in
pdo?
because:
Finally upgraded to mysql-5.0.26 and
reinstalled gentoo's dev-lang/php-5.1.6-r6
testcase prints out expected result.
------------------------------------------------------------------------
[2006-10-20 21:46:40] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Works just fine here.
------------------------------------------------------------------------
[2006-10-20 18:15:50] jan_metzel at gmx dot de
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 this bug report at http://bugs.php.net/?id=39218&edit=1
Thread (4 messages)