}
}
+ if (stmt) {
+ /* always propogate the error code back up to the dbh,
+ * so that we can catch the error information when execute
+ * is called via query. See Bug #33707 */
+ if (H->einfo.errmsg) {
+ efree(H->einfo.errmsg);
+ }
+ H->einfo = *einfo;
+ H->einfo.errmsg = einfo->errmsg ? estrdup(einfo->errmsg) : NULL;
+ strcpy(dbh->error_code, stmt->error_code);
+ }
+
/* little mini hack so that we can use this code from the dbh ctor */
if (!dbh->methods) {
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
--- /dev/null
+--TEST--
+PDO OCI Bug #33707
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require 'ext/pdo_oci/tests/config.inc';
+require 'ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require 'ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
+$db->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_SILENT);
+
+$rs = $db->query('select blah from a_table_that_doesnt_exist');
+var_dump($rs);
+var_dump($db->errorInfo());
+
+--EXPECTF--
+bool(false)
+array(3) {
+ [0]=>
+ string(5) "HY000"
+ [1]=>
+ int(942)
+ [2]=>
+ string(113) "OCIStmtExecute: ORA-00942: table or view does not exist
+ (%s:%d)"
+}