php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80150 Failure to fetch error message
Submitted: 2020-09-25 15:24 UTC Modified: 2020-09-25 15:24 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: 7.3.22 OS: *
Private report: No CVE-ID: None
 [2020-09-25 15:24 UTC] cmb@php.net
Description:
------------
In case of failure, several ODBC functions, e.g. odbc_tables() and
odbc_columns(), fail to fetch the error message.  The problem is
that odbc_sql_error() is called with SQL_NULL_HSTMT, although the
respective statement caused the error, and has appropriate error
information.

This can nicely be confirmed with the Microsoft Access Driver
(*.mdb, *.accdb), because that driver has rather limited
capabilities.


Test script:
---------------
<?php
$conn = odbc_connect($dsn, $user, $pass);
var_dump($result = odbc_tables($conn, '', '', '', ''));
var_dump(odbc_error($conn));
?>


Expected result:
----------------
Warning: odbc_tables(): SQL error: [Microsoft][ODBC-Treiber fr Microsoft Access]Optionales Feature wurde nicht implementiert. , SQL state S1C00 in SQLTables in %s on line %d
bool(false)
string(5) "S1C00"


Actual result:
--------------
Warning: odbc_tables(): SQL error: Failed to fetch error message, SQL state HY000 in SQLTables in %s on line %d
bool(false)
string(5) "HY000"


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-25 15:24 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-09-25 15:36 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #80150: Failure to fetch error message
On GitHub:  https://github.com/php/php-src/pull/6217
Patch:      https://github.com/php/php-src/pull/6217.patch
 [2020-09-29 09:06 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=df5efa2fcdbcc9f6dea792caa149897060b350f7
Log: Fix #80150: Failure to fetch error message
 [2020-09-29 09:06 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 20:01:23 2020 UTC