From 0781f512c38024c9f69720a72de11857cd546456 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 4 Aug 2016 14:48:07 +1000 Subject: [PATCH 1/2] Fixed invalid handle error with Implicit Result Sets and bump OCI8 version. --- ext/oci8/oci8.c | 3 ++- ext/oci8/package.xml | 26 +++++++++++++++++++++----- ext/oci8/php_oci8.h | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 51861b090ca..488b3b42aab 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -2559,7 +2559,8 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg #else /* OCI_MAJOR_VERSION */ PHP_OCI_ZVAL_TO_STATEMENT(z_statement, invokedstatement); - if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN) { + if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN || + invokedstatement->impres_flag == PHP_OCI_IMPRES_IS_CHILD) { /* Already know there are no Implicit Result Sets */ statement = invokedstatement; } else if (invokedstatement->impres_flag == PHP_OCI_IMPRES_HAS_CHILDREN) { diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index 88462415cbf..daa55eb2a96 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -9,7 +9,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> Use the OCI8 extension to access Oracle Database. PHP OCI8 2.1 builds -with PHP 7. Use 'pecl install oci8-2.0.11' to install OCI8 for PHP +with PHP 7. Use 'pecl install oci8-2.0.12' to install OCI8 for PHP 5.2 - PHP 5.6. Use 'pecl install oci8-1.4.10' to install PHP OCI8 1.4 for PHP 4.3.9 - PHP 5.1. The OCI8 extension can be linked with Oracle client libraries from Oracle Database 12.1, 11, or 10.2. These @@ -46,12 +46,12 @@ Interoperability Support" (ID 207303.1) for details. no - 2016-04-15 + 2016-08-04 - 2.1.1 - 2.1.1 + 2.1.2 + 2.1.2 stable @@ -60,7 +60,7 @@ Interoperability Support" (ID 207303.1) for details. PHP This version is for PHP 7 only. -Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) +Fixed invalid handle error with Implicit Result Sets @@ -467,6 +467,22 @@ Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) + + + 2.1.1 + 2.1.1 + + + stable + stable + + PHP + +This version is for PHP 7 only. +Fixed bug #71600 (oci_fetch_all segfaults when selecting more than 8 columns) + + + 2.1.0 diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index da62aabac63..d1e501344a4 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -45,7 +45,7 @@ */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "2.1.1" +#define PHP_OCI8_VERSION "2.1.2" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry From d3a8e107acb4f729016b6d649bc83a888359fb7d Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Thu, 4 Aug 2016 09:28:58 +0200 Subject: [PATCH 2/2] Clean up FR #72633 --- NEWS | 2 +- ext/pdo_pgsql/pgsql_driver.c | 7 ++++--- ext/pdo_pgsql/php_pdo_pgsql_int.h | 2 -- .../tests/{bug_last_insert_id.phpt => bug72633.phpt} | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) rename ext/pdo_pgsql/tests/{bug_last_insert_id.phpt => bug72633.phpt} (86%) diff --git a/NEWS b/NEWS index 51d59f4026a..21427cc9e5b 100644 --- a/NEWS +++ b/NEWS @@ -72,7 +72,7 @@ PHP NEWS - PDO_pgsql: . Fixed bug #70313 (PDO statement fails to throw exception). (Matteo) . Implemented FR #72633 (Postgres PDO lastInsertId() should work without - specifying a sequence). (Pablo Santiago Sánchez) + specifying a sequence). (Pablo Santiago Sánchez, Matteo) - Reflection: . Fixed bug #72222 (ReflectionClass::export doesn't handle array constants). diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 52a77684923..5b78bcc4381 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -360,12 +360,13 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned char *id = NULL; PGresult *res; ExecStatusType status; - const char *q[1]; - q[0] = name; - if (PHP_PDO_PGSQL_LASTVAL_PG_VERSION <= PQserverVersion(H->server) && name == NULL) { + if (name == NULL) { res = PQexec(H->server, "SELECT LASTVAL()"); } else { + const char *q[1]; + q[0] = name; + res = PQexecParams(H->server, "SELECT CURRVAL($1)", 1, NULL, q, NULL, NULL, 0); } status = PQresultStatus(res); diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 2876b312b7f..eb645c58c4d 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -29,8 +29,6 @@ #define PHP_PDO_PGSQL_CONNECTION_FAILURE_SQLSTATE "08006" -#define PHP_PDO_PGSQL_LASTVAL_PG_VERSION 80100 - typedef struct { const char *file; int line; diff --git a/ext/pdo_pgsql/tests/bug_last_insert_id.phpt b/ext/pdo_pgsql/tests/bug72633.phpt similarity index 86% rename from ext/pdo_pgsql/tests/bug_last_insert_id.phpt rename to ext/pdo_pgsql/tests/bug72633.phpt index 30dd0f039a0..06bd25e6268 100644 --- a/ext/pdo_pgsql/tests/bug_last_insert_id.phpt +++ b/ext/pdo_pgsql/tests/bug72633.phpt @@ -1,5 +1,5 @@ --TEST-- -currval() vs lastval() - PDO PgSQL Bug #1134 [BUG] New record, PostgreSQL and the Primary key https://github.com/phalcon/cphalcon/issues/1134 +PDO PgSQL Bug #72633 (Postgres PDO lastInsertId() should work without specifying a sequence) --SKIPIF--