|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58791 PDO-OCI does not throw exception with malformed sql
Submitted: 2009-08-04 11:30 UTC Modified: 2013-02-18 00:35 UTC
From: gonzalo123 at gmail dot com Assigned:
Status: No Feedback Package: PDO_OCI (PECL)
PHP Version: 5.2.10 OS: Linux 32(Suse)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-08-04 11:30 UTC] gonzalo123 at gmail dot com
PDO doesn't throw any exception (at least with Oracle) in some cases but I can see the error with $db->errorInfo(). I notice this happens when I bind some unexistent variables to the query. I know it is wrong (bind unexistent variables) but in my opinion PDO must throw an exception (because $db->errorInfo() knows the error)

Reproduce code:
// create table TBLDUMMY (FIELD1 VARCHAR2(2), FIELD2 VARCHAR2(2))
$db = new PDO(
    $dsn, // my DB dsn
    $user, // database username
    $password); // database password
try {
    $sql = "select FIELD1, FIELD2 FROM TBLDUMMY";
    //$sqlOK = "select FIELD1, FIELD2 FROM TBLDUMMY WHERE FIELD1=:F1";
    $stmt = $db->prepare($sql);
    $stmt->execute(array('F1' => '1'));
    $result = $stmt->fetchAll();
    echo "<pre>";
    echo "</pre>";

} catch (Exception $e) {
    echo "Exception:" . $e->getMessage();

Expected result:
Exception OCIBindByName: ORA-01036: n?mero/nombre de variable no v?lido

Actual result:
    [0] => HY000
    [1] => 1036
    [2] => OCIBindByName: ORA-01036: n?mero/nombre de variable no v?lido


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-06 06:39 UTC]
(Fixed package name).

Are you using the PECL driver? Please try to the distributed with PHP.

If you are experiencing this issue in the PHP distributed PDO_OCI, please refile this bug report against PHP at
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 04:01:28 2024 UTC