summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rwxr-xr-xext/pdo/pdo_dbh.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 2d3d20c0d4..e071ca8958 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -983,6 +983,11 @@ static PHP_METHOD(PDO, errorCode)
RETURN_STRING(dbh->query_stmt->error_code, 1);
}
+ if (dbh->error_code[0] == '\0') {
+ RETURN_NULL();
+ }
+
+ // Then we get back to the default fallback
RETURN_STRING(dbh->error_code, 1);
}
/* }}} */
@@ -1004,6 +1009,8 @@ static PHP_METHOD(PDO, errorInfo)
add_next_index_string(return_value, dbh->query_stmt->error_code, 1);
} else {
add_next_index_string(return_value, dbh->error_code, 1);
+ add_next_index_null(return_value);
+ add_next_index_null(return_value);
}
if (dbh->methods->fetch_err) {
dbh->methods->fetch_err(dbh, dbh->query_stmt, return_value TSRMLS_CC);