Skip to content

PDO OCI binds boolean false as NULL #15182

@morozov

Description

@morozov

Description

The following code:

<?php

$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();
var_dump($stmt->fetchAll(PDO::FETCH_NUM));

Resulted in this output:

array(2) {
  [0] =>
  string(1) "1"
  [1] =>
  NULL
}

But I expected this output instead:

array(2) {
  [0] =>
  string(1) "1"
  [1] =>
  string(1) "0"
}

PHP Version

PHP 8.3.8

Operating System

Linux

The issue was originally reported as bug #81586, discovered via doctrine/dbal#2481.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions