Bug #73234 [Asn->Csd]: emulated statements let value dictate parameter type

From: Date: Mon, 10 Oct 2016 22:16:31 +0000
Subject: Bug #73234 [Asn->Csd]: emulated statements let value dictate parameter type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204584@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73234&edit=1

 ID:                 73234
 Updated by:         adambaratz@php.net
 Reported by:        adambaratz@php.net
 Summary:            emulated statements let value dictate parameter type
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            PDO Core
 PHP Version:        Irrelevant
 Assigned To:        adambaratz
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=32b6154a61fae820386527f3019f8c5937fc5d27
Log: Fix #73234: Emulated statements let value dictate parameter type


Previous Comments:
------------------------------------------------------------------------
[2016-10-03 15:19:52] adambaratz@php.net

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 this bug report at https://bugs.php.net/bug.php?id=73234&edit=1


Thread (3 messages)

« previous php.bugs (#204584) next »