php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42935 pdo error handler is broken
Submitted: 2007-10-11 21:20 UTC Modified: 2008-10-29 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: denis at mesoconcepts dot com Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.4 OS: freebsd
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: denis at mesoconcepts dot com
New email:
PHP Version: OS:

 

 [2007-10-11 21:20 UTC] denis at mesoconcepts dot com
Description:
------------
using select 1 where something is null returns an empty array

D.

Reproduce code:
---------------
try
{
	$dbh =& new PDO(
		'pgsql:host=' . $db_host . ';dbname=' . $db_name,
		$db_user,
		$db_pass
		);
}

$dbs = $dbh->prepare("
	SELECT	1
	WHERE	? IS NOT NULL
	");

$dbs->execute(array(1));

$res = $dbs->fetchAll();

var_dump($res);

Expected result:
----------------
a row

Actual result:
--------------
no rows

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-11 21:23 UTC] denis at mesoconcepts dot com
was of course meant: when something is __not__ null
 [2007-10-11 21:29 UTC] denis at mesoconcepts dot com
further investigation led us to identify this query as a solution:

$dbs = $dbh->prepare(' SELECT	1 WHERE	(?)::int4 IS NOT NULL ');

nonetheless, it would be sweet if pdo identified the first as an integer indeed.
 [2007-10-11 21:36 UTC] denis at mesoconcepts dot com
pdo should generate an error when it cannot assign a type for a prepared statement
 [2008-10-21 11:36 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-10-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 14:01:36 2024 UTC