Bug #68351 [NEW]: PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving

From: Date: Wed, 05 Nov 2014 15:04:51 +0000
Subject: Bug #68351 [NEW]: PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188465@lists.php.net to get a copy of this message
From:             mbeccati
Operating system: *
PHP version:      5.5Git-2014-11-05 (snap)
Package:          PDO PgSQL
Bug Type:         Bug
Bug description:PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving

Description:
------------
The fix for #62593 is not handling non-bool or int values correctly when
bound as PDO::PARAM_BOOL.

Test script:
---------------
$db = new PDO("...");
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$query = $db->prepare('SELECT :foo IS FALSE as val_is_false');
$value = '0';
$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
$query->execute();
var_dump($query->fetchColumn());


Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=68351&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=68351&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=68351&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=68351&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=68351&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=68351&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=68351&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=68351&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=68351&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=68351&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=68351&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=68351&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=68351&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=68351&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68351&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=68351&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=68351&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=68351&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68351&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=68351&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=68351&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#188465) next »