#39398 [Opn->Csd]: No cast of logic type and silence
| From: | iliaa@php.net | Date: | Tue, 07 Nov 2006 17:57:43 +0000 |
| Subject: | #39398 [Opn->Csd]: No cast of logic type and silence | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104535@lists.php.net to get a copy of this message | ||
ID: 39398
Updated by: iliaa@php.net
Reported By: develar at gmail dot com
-Status: Open
+Status: Closed
Bug Type: PDO related
Operating System: Debian 3
PHP Version: 5.2.0
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-11-06 11:59:31] develar at gmail dot com
var_dump($Db->query('SELECT * FROM test')->fetchAll());
------------------------------------------------------------------------
[2006-11-06 11:56:04] develar at gmail dot com
Description:
------------
PDO does not cast a variable with boolean type in bindValue, does not
do execute and is silent.
I should cast manually - (int).
Reproduce code:
---------------
CREATE TABLE
test (
test tinyint(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
$Db = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$Db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$Db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$boolean = 1;
$Pdo = $Db->prepare('INSERT INTO test VALUES (:boolean)');
$Pdo->bindValue(':boolean', isset($boolean), PDO::PARAM_INT);
$Pdo->execute();
Expected result:
----------------
array(1) { [0]=> array(1) { ["test"]=> string(1) "1" } }
Actual result:
--------------
array(0) { }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39398&edit=1