Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDO OCI binds boolean false as NULL #12

Open
morozov opened this issue Jan 22, 2025 · 0 comments
Open

PDO OCI binds boolean false as NULL #12

morozov opened this issue Jan 22, 2025 · 0 comments

Comments

@morozov
Copy link

morozov commented Jan 22, 2025

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, then php/php-src#15182. Discovered via doctrine/dbal#2481.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant