]> granicus.if.org Git - php/commitdiff
Bump mininum requirements for PHP OCI8 2.0 to PHP 5.2 and Oracle
authorChristopher Jones <sixd@php.net>
Tue, 8 Oct 2013 00:23:11 +0000 (17:23 -0700)
committerChristopher Jones <sixd@php.net>
Tue, 8 Oct 2013 00:23:11 +0000 (17:23 -0700)
client library 10.2 (Note this will connect to Oracle Database 8.1.7
onwards). Use the older OCI8 1.4 from PECL if using an earlier PHP
version or older Oracle client library support is necessary.

ext/oci8/config.m4
ext/oci8/config.w32
ext/oci8/oci8.c
ext/oci8/oci8_collection.c
ext/oci8/oci8_interface.c
ext/oci8/oci8_lob.c
ext/oci8/package.xml
ext/oci8/php_oci8_int.h

index 3873a2205aa3644a16764c97cca641f501e8e2e4..0d08d21c29e614454d75dfc870c3daa5f605e54f 100644 (file)
@@ -208,8 +208,8 @@ if test "$PHP_OCI8" != "no"; then
   IFS=$ac_IFS
   oci8_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
 
-  if test "$oci8_php_version" -lt "4003009"; then
-    AC_MSG_ERROR([You need at least PHP 4.3.9 to be able to use this version of OCI8. PHP $php_version found])
+  if test "$oci8_php_version" -lt "5002000"; then
+    AC_MSG_ERROR([You need at least PHP 5.2.0 to be able to use this version of OCI8. PHP $php_version found])
   else
     AC_MSG_RESULT([$php_version, ok])
   fi
@@ -332,24 +332,8 @@ if test "$PHP_OCI8" != "no"; then
     AC_OCI8_ORACLE_VERSION($OCI8_DIR)
 
     case $OCI8_ORACLE_VERSION in
-      7.3|8.0|8.1)
-       AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
-       ;;
-
-      9.0)
-       PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
-       [
-         OCI8_ORACLE_VERSION=9.2
-       ],
-       [
-         AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported])
-       ], [
-         -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
-       ])
-       ;;
-
-      *)
-       AC_DEFINE(HAVE_OCI_LOB_READ2,1,[Defined to 1 if OCI8 configuration located Oracle's OCILobRead2 function])
+      7.3|8.0|8.1|9.0)
+       AC_MSG_ERROR([Oracle client libraries < 10 are not supported])
        ;;
     esac
 
@@ -425,7 +409,6 @@ if test "$PHP_OCI8" != "no"; then
     PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
 
     AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[Defined to 1 if OCI8 configuration located Oracle's Instant Client libraries])
-    AC_DEFINE(HAVE_OCI_LOB_READ2,1,[Defined to 1 if OCI8 configuration located Oracle's OCILobRead2 function])
 
     PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
     AC_DEFINE(HAVE_OCI8,1,[Defined to 1 if the PHP OCI8 extension for Oracle Database is configured])
index ac573a8af39a1b5d8359d4113d73958ec633bb6c..750f163950cc96f5628749eb84e4b833f46873c8 100644 (file)
@@ -29,8 +29,6 @@ if (PHP_OCI8_12C != "no") {
 
                AC_DEFINE('HAVE_OCI8', 1);
                AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
-               AC_DEFINE('HAVE_OCI_LOB_READ2', 1);
-
        } else {
                WARNING("oci8-12c not enabled: Oracle Database client libraries or Oracle Database 12c Instant Client not found");
                PHP_OCI8_12C = "no"
index eeb1ade7bb802826174be17369dc17fd6173355b..f8abacf3e6c6a7398c2be67c61f1cbce777fd50d 100644 (file)
 
 #if HAVE_OCI8
 
-#if PHP_MAJOR_VERSION > 5
-#error This version of the PHP OCI8 extension is not compatible with PHP 6 or later
-#elif PHP_MAJOR_VERSION < 5
-#ifdef ZTS
-#error The PHP OCI8 extension does not support ZTS mode in PHP 4
-#endif
+/* PHP 5.2 is the minimum supported version for OCI8 2.0 */
+#if PHP_MAJOR_VERSION < 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 1)
+#error Use PHP OCI8 1.4 for your version of PHP
 #endif
 
 #include "php_oci8.h"
 #endif
 
 ZEND_DECLARE_MODULE_GLOBALS(oci)
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-/* This "if" allows PECL builds from this file to be portable to older PHP releases */
 static PHP_GINIT_FUNCTION(oci);
 static PHP_GSHUTDOWN_FUNCTION(oci);
-#endif
 
 /* Allow PHP 5.3 branch to be used in PECL for 5.x compatible builds */
 #ifndef Z_ADDREF_P
@@ -1055,16 +1049,11 @@ zend_module_entry oci8_module_entry = {
        PHP_RSHUTDOWN(oci),       /* per-request shutdown function */
        PHP_MINFO(oci),           /* information function */
        PHP_OCI8_VERSION,
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-       /* This check allows PECL builds from this file to be portable to older PHP releases */
        PHP_MODULE_GLOBALS(oci),  /* globals descriptor */
        PHP_GINIT(oci),                   /* globals ctor */
        PHP_GSHUTDOWN(oci),               /* globals dtor */
        NULL,                                     /* post deactivate */
        STANDARD_MODULE_PROPERTIES_EX
-#else
-       STANDARD_MODULE_PROPERTIES
-#endif
 };
 /* }}} */
 
@@ -1183,12 +1172,7 @@ static void php_oci_cleanup_global_handles(TSRMLS_D)
  *
  * Zerofill globals during module init
  */
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-/* This check allows PECL builds from this file to be portable to older PHP releases */
 static PHP_GINIT_FUNCTION(oci)
-#else
-static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC)
-#endif
 {
        memset(oci_globals, 0, sizeof(zend_oci_globals));
 }
@@ -1198,12 +1182,7 @@ static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC)
  *
  * Called for thread shutdown in ZTS, after module shutdown for non-ZTS
  */
-/* This check allows PECL builds from this file to be portable to older PHP releases */
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
 static PHP_GSHUTDOWN_FUNCTION(oci)
-#else
-static void php_oci_shutdown_globals(zend_oci_globals *oci_globals TSRMLS_DC)
-#endif
 {
        php_oci_cleanup_global_handles(TSRMLS_C);
 }
@@ -1214,12 +1193,6 @@ PHP_MINIT_FUNCTION(oci)
        zend_class_entry oci_lob_class_entry;
        zend_class_entry oci_coll_class_entry;
 
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-       /* This check allows PECL builds from this file to be portable to older PHP releases */
-       /* this is handled by new globals management code */
-#else
-       ZEND_INIT_MODULE_GLOBALS(oci, php_oci_init_globals, php_oci_shutdown_globals);
-#endif
        REGISTER_INI_ENTRIES();
 
        le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number);
@@ -1331,13 +1304,6 @@ PHP_RINIT_FUNCTION(oci)
 
 PHP_MSHUTDOWN_FUNCTION(oci)
 {
-/* Work around PHP_GSHUTDOWN_FUNCTION not being called in older versions of PHP */
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) || (PHP_MAJOR_VERSION < 5)
-#ifndef ZTS
-       php_oci_cleanup_global_handles(TSRMLS_C);
-#endif
-#endif
-
        OCI_G(shutdown) = 1;
 
        UNREGISTER_INI_ENTRIES();
index 320e90a5b899924be85e7bbcb835d0d56825794c..35b70fa7af73f358fbc1de69f6c11da5b7ed4856 100644 (file)
@@ -361,13 +361,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
        php_oci_connection *connection = collection->connection;
        sword errstatus;
 
-#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
-       /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
-       element_double = strtod(number, NULL);
-#else
-       /* zend_strtod was introduced in PHP 4.3.10 */
        element_double = zend_strtod(number, NULL);
-#endif
                        
        PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
 
@@ -666,13 +660,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
        php_oci_connection *connection = collection->connection;
        sword errstatus;
 
-#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
-       /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
-       element_double = strtod(number, NULL);
-#else
-       /* zend_strtod was introduced in PHP 4.3.10 */
        element_double = zend_strtod(number, NULL);
-#endif
                        
        PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
 
index a452c1a7e2902e4fa8face1ad1ed1ad21f41eda4..ccaed797429f1188790e61e6b196b9a875fee8d4 100644 (file)
@@ -1429,13 +1429,7 @@ PHP_FUNCTION(oci_fetch_all)
                                if (flags & PHP_OCI_NUM) {
                                        zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
                                } else { /* default to ASSOC */
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-                                       /* zend_symtable_update is only available in 5.2+ */
                                        zend_symtable_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
-#else
-                                       /* This code path means Bug #45458 will remain broken when OCI8 is built with PHP 4 */
-                                       zend_hash_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
-#endif
                                }
                        }
 
@@ -1467,13 +1461,7 @@ PHP_FUNCTION(oci_fetch_all)
                                
                                MAKE_STD_ZVAL(tmp);
                                array_init(tmp);
-#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
-                               /* zend_symtable_update is only available in 5.2+ */
                                zend_symtable_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
-#else
-                               /* This code path means Bug #45458 will remain broken when OCI8 is built with PHP 4 */
-                               zend_hash_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
-#endif
                        }
                }
 
index 8d14dc3f503aa9145784f2b1fd4889f0b5c0e387..4f58c65737f97661c675d8a11b33617f9fe00fbc 100644 (file)
@@ -165,11 +165,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
 
 /* {{{ php_oci_lob_callback()
    Append LOB portion to a memory buffer */
-#if defined(HAVE_OCI_LOB_READ2)
 sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp)
-#else
-sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
-#endif
 {
        ub4 lenp = (ub4) len;
        php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
@@ -251,14 +247,9 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
        php_oci_lob_ctx ctx;
        ub1 *bufp;
-#if defined(HAVE_OCI_LOB_READ2)
        oraub8 bytes_read, offset = 0;
        oraub8 requested_len = read_length; /* this is by default */
        oraub8 chars_read = 0;
-#else
-       int bytes_read, offset = 0;
-       int requested_len = read_length; /* this is by default */
-#endif
        int is_clob = 0;
        sb4 bytes_per_char = 1;
        sword errstatus;
@@ -336,7 +327,6 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        ctx.alloc_len = (requested_len + 1) * bytes_per_char;
        *data = ecalloc(bytes_per_char, requested_len + 1);
 
-#ifdef HAVE_OCI_LOB_READ2
        if (is_clob) {
                chars_read = requested_len;
                bytes_read = 0;
@@ -374,34 +364,6 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        } else {
                offset = descriptor->lob_current_position + bytes_read;
        }
-
-#else
-
-       bytes_read = requested_len;
-       buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size;             /* optimize buffer size */
-       buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC);  /* use chunk size */
-
-       bufp = (ub1 *) ecalloc(1, buffer_size);
-       PHP_OCI_CALL_RETURN(errstatus, OCILobRead,
-               (
-                        connection->svc,
-                        connection->err,
-                        descriptor->descriptor,
-                        &bytes_read,                                                            /* IN/OUT bytes toread/read */
-                        offset + 1,                                                     /* offset (starts with 1) */
-                        (dvoid *) bufp,
-                        (ub4) buffer_size,                                                      /* size of buffer */
-                        (dvoid *)&ctx,
-                        (OCICallbackLobRead) php_oci_lob_callback,                              /* callback... */
-                        (ub2) descriptor->charset_id,                          /* The character set ID of the buffer data. */
-                        (ub1) descriptor->charset_form                                    /* The character set form of the buffer data. */
-               )
-       );
-       
-       efree(bufp);
-       offset = descriptor->lob_current_position + bytes_read;
-
-#endif
        
        if (errstatus != OCI_SUCCESS) {
                connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
index 1161b031f33a06b4b431cafd7f829f998bc3db0a..d2c49726a877c655a0eb40cfa91999418f7bad1a 100644 (file)
@@ -8,12 +8,15 @@ http://pear.php.net/dtd/package-2.0.xsd">
  <summary>Extension for Oracle Database</summary>
 
  <description>
-   This extension allows you to access Oracle Database. OCI8 2.0 can
-   be built with PHP 4.3.9 onwards. OCI8 can be linked with Oracle
-   Database 9.2, 10, 11, or 12.1 client libraries.  Oracle's standard
-   cross-version connectivity applies.  For example PHP linked with
-   Oracle Database 11.2 client libraries can connect to Oracle
-   Database 9.2 onwards.
+The PHP OCI8 extension gives access to Oracle Database. The extension
+can be linked with Oracle client libraries from Oracle Database 10.2,
+11, or 12.1. These libraries are found in the database installation,
+or in the free Oracle Instant Client. Oracle's standard cross-version
+connectivity applies.  For example, PHP OCI8 linked with Instant
+Client 11.2 can connect to Oracle Database 9.2 onwards.  PHP OCI8 2.0
+can be built with PHP 5.2 onwards. Use the older PHP OCI8 1.4.10 when
+using PHP 4.3.9 through to PHP 5.1.x, or when only Oracle Database 9.2
+client libraries are available.
  </description>
  <lead>
   <name>Christopher Jones</name>
@@ -40,7 +43,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <active>no</active>
  </lead>
 
- <date>2013-09-27</date>
+ <date>2013-10-08</date>
  <time>12:00:00</time>
 
   <version>
@@ -53,7 +56,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
   </stability>
   <license uri="http://www.php.net/license">PHP</license>
   <notes>
-   - no notes yet
+Bump mininum requirements for PHP OCI8 2.0 to PHP 5.2 and Oracle
+client library 10.2 (Note this will connect to Oracle Database 8.1.7
+onwards). Use the older OCI8 1.4 if an earlier PHP version or older
+Oracle client library support is necessary.
   </notes>
  <contents>
   <dir name="/">
@@ -438,8 +444,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
  <dependencies>
   <required>
    <php>
-    <min>4.3.9</min>
-    <max>6.0.0</max>
+    <min>5.2.0</min>
    </php>
    <pearinstaller>
     <min>1.4.0b1</min>
index 2d4ff26947e99c353c6449d6869e6c3ee870caf9..e50983d75eb532d44f1801fa85584072f4c3c0c6 100644 (file)
@@ -438,11 +438,7 @@ int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *
 int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC);
 int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC);
 int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC);
-#if defined(HAVE_OCI_LOB_READ2)
 sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
-#else
-sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
-#endif
 /* }}} */
 
 /* {{{ collection related prototypes */