This is a problem I've run into with pdo_dblib, but the fix would involve
touching PDO Core. I'd appreciate any feedback on potential negative
interactions with other drivers, as well as which PHP version I should
target the fix for. It's arguable whether this is a bug or a feature
request. If I don't hear from anyone, I'll keep it to master to give others
the most time to prepare.

Thanks,
Adam

---------- Forwarded message ----------
From: adambar...@php.net <php-b...@lists.php.net>
Date: Mon, Oct 3, 2016 at 11:19 AM
Subject: [PHP-BUG] Bug #73234 [NEW]: emulated statements let value dictate
parameter type
To: php-b...@lists.php.net


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

Reply via email to