Bug #73234 [NEW]: emulated statements let value dictate parameter type
From: adambaratz
Operating system:
PHP version: Irrelevant
Package: PDO Core
Bug Type: Bug
Bug description:emulated statements let value dictate parameter type
Description:
------------
See test script. I would expect both statements to return NULL. Given
the looseness of PHP's type system, this feels appropriate and safer.
There's a related issue where numbers can end up treated as strings.
Test script:
---------------
$db = new PDO(...);
$stmt = $db->prepare("SELECT :null");
$stmt->bindValue(':null', null, PDO::PARAM_NULL);
$stmt->execute();
var_dump($stmt->fetchAll()); // NULL
$stmt = $db->prepare("SELECT :null");
$stmt->bindValue(':null', 0, PDO::PARAM_NULL);
$stmt->execute();
var_dump($stmt->fetchAll()); // 0
--
Edit bug report at https://bugs.php.net/bug.php?id=73234&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73234&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73234&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73234&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73234&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73234&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73234&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73234&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73234&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73234&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73234&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73234&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73234&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73234&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73234&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73234&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73234&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73234&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73234&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73234&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73234&r=mysqlcfg
Thread (3 messages)
- adambaratz@php.net