Bug #81586 [Com]: PDO OCI binds boolean false as NULL

From: Date: Thu, 01 Dec 2022 05:07:19 +0000
Subject: Bug #81586 [Com]: PDO OCI binds boolean false as NULL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243009@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81586&edit=1

 ID:                 81586
 Comment by:         farid dot jamili4118 at gmail dot com
 Reported by:        morozov at tut dot by
 Summary:            PDO OCI binds boolean false as NULL
 Status:             Open
 Type:               Bug
 Package:            PDO OCI
 Operating System:   Linux
 PHP Version:        8.0.12
 Block user comment: N
 Private report:     N

 New Comment:

A really good post, very thankful and hopeful that you will write many more posts like this one.		


(https://www.rapidfs.online/)php.net


Previous Comments:
------------------------------------------------------------------------
[2021-11-02 17:50:38] morozov at tut dot by

Description:
------------
It looks like the extension doesn't implement any special handling of the PDO::PARAM_BOOL
binding type which makes the logic of binding boolean values inconsistent with the rest of the PDO
extensions.

Test script:
---------------
$conn = new
PDO('oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)))',
'system', 'oracle');
$stmt = $conn->prepare('SELECT ?, ? FROM DUAL');
$stmt->bindValue(1, true, PDO::PARAM_BOOL);
$stmt->bindValue(2, false, PDO::PARAM_BOOL);
$stmt->execute();


Expected result:
----------------
array(2) {
  [0] =>
  string(1) "1"
  [1] =>
  string(1) "0"
}


Actual result:
--------------
array(2) {
  [0] =>
  string(1) "1"
  [1] =>
  NULL
}



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81586&edit=1


Thread (6 messages)

« previous php.bugs (#243009) next »