Sync OCI8 on PHP 7.x branches
authorTianfang Yang <tianfyan@php.net>
Mon, 14 Aug 2017 03:44:24 +0000 (23:44 -0400)
committerTianfang Yang <tianfyan@php.net>
Mon, 14 Aug 2017 03:44:24 +0000 (23:44 -0400)
ext/oci8/oci8_collection.c
ext/oci8/oci8_interface.c
ext/oci8/oci8_lob.c
ext/oci8/oci8_statement.c
ext/oci8/php_oci8.h
ext/oci8/php_oci8_int.h
ext/oci8/tests/bug72524.phpt
ext/oci8/tests/coll_019.phpt
ext/oci8/tests/lob_040.phpt
ext/oci8/tests/xmltype_02.phpt

index a7055e4d654c913e21542676bac869b88030c08b..9e0ea6912069134ebd003c16d015da79701318a6 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
index b0a8104827638c5d50e3275affd2e81a9b51619f..5da3084520e451f5132e6bf565524a3001b8708d 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
@@ -56,13 +56,21 @@ PHP_FUNCTION(oci_register_taf_callback)
        }
 
        if (callback) {
+#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)    
+               if (!zend_is_callable(callback, 0, 0)) {
+                       callback_name = zend_get_callable_name(callback);
+                       php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
+                       zend_string_release(callback_name);
+                       RETURN_FALSE;
+               }
+#else
                if (!zend_is_callable(callback, 0, &callback_name)) {
                        php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
                        zend_string_release(callback_name);
                        RETURN_FALSE;
                }
-
                zend_string_release(callback_name);
+#endif
        }
 
        PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
index d8755d1cfaed78fc803ef28c98fc82545e7c6cdc..5e3107edfcff467db6981db71b3c3ddabe6eb264 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
index 470d8d0d9400364f7e036ff42dd6373e42f5a4bf..7639340c129a6dc15ce4770f62a85e30f19c46cb 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
index c236f6c19f9f12cb1a845a2c4e6bfff0439a15fc..e70e2fe09cdef506bd54771714f100df9fc2bfb5 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
index 5e74bb0096c826b706b08140cc86ad17de8719f0..97ccbd5776253e357337071ec78e0e12f5b9711b 100644 (file)
@@ -12,7 +12,7 @@
    | obtain it through the world-wide-web, please send a note to          |
    | license@php.net so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |                                                                      |
    | Collection support by Andy Sautins <asautins@veripost.net>           |
index dde99b000c164a89722c60194fc058e6c4af9192..45ce8c7d5b54048441119d002d29ad4ccf95d0e9 100644 (file)
@@ -1,96 +1,96 @@
---TEST--\r
-Bug #72524 (Binding null values triggers ORA-24816 error)\r
---SKIPIF--\r
-<?php\r
-$target_dbs = array('oracledb' => true, 'timesten' => true);  // test runs on these DBs\r
-require(dirname(__FILE__).'/skipif.inc');\r
-?>\r
---FILE--\r
-\r
-<?php\r
-\r
-require(dirname(__FILE__).'/connect.inc');\r
-\r
-// Initialize\r
-\r
-$stmtarray = array(\r
-         "CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"\r
-);\r
-\r
-oci8_test_sql_execute($c, $stmtarray);\r
-\r
-// Run test\r
-\r
-$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";\r
-\r
-echo "Test 1 - P1 Value: NULL  P1 Length: Default  P1 Type: Default  P2 Value: NULL P2 Length: Default  P2 Type: Default\n";\r
-$stmt = oci_parse($c, $sql);\r
-\r
-$clob = NULL;\r
-$varchar2 = NULL;\r
-oci_bind_by_name($stmt, ':clob_col', $clob);\r
-oci_bind_by_name($stmt, ':varchar2_col', $varchar2);\r
-\r
-var_dump(oci_execute($stmt));\r
-\r
-echo "Test 2 - P1 Value: ''    P1 Length: Default  P1 Type: Default  P2 Value: ''   P2 Length: Default  P2 Type: Default\n";\r
-\r
-$clob = '';\r
-$varchar2 = '';\r
-oci_bind_by_name($stmt, ':clob_col', $clob);\r
-oci_bind_by_name($stmt, ':varchar2_col', $varchar2);\r
-\r
-var_dump(oci_execute($stmt));\r
-\r
-echo "Test 3 - P1 Value: 'abc' P1 Length: 0        P1 Type: Default  P2 Value: ''   P2 Length: 0        P2 Type: Default\n";\r
-$clob = 'abc';\r
-$varchar2 = 'abc';\r
-oci_bind_by_name($stmt, ':clob_col', $clob, 0);\r
-oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);\r
-\r
-var_dump(oci_execute($stmt));\r
-\r
-echo "Test 4 - P1 Value: NULL  P1 Length: -1       P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1       P2 Type:Default\n";\r
-$clob = NULL;\r
-$varchar2 = NULL;\r
-oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);\r
-oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);\r
-\r
-var_dump(oci_execute($stmt));\r
-\r
-echo "Test 5 - P1 Value: NULL  P1 Length: 0        P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0        P2 Type:Default\n";\r
-$clob = NULL;\r
-$varchar2 = NULL;\r
-oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);\r
-oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);\r
-\r
-\r
-var_dump(oci_execute($stmt));\r
-\r
-// Cleanup\r
-\r
-$stmtarray = array(\r
-    "DROP TABLE mytable"\r
-);\r
-\r
-oci8_test_sql_execute($c, $stmtarray);\r
-\r
-?>\r
-===DONE===\r
-<?php exit(0); ?>\r
---EXPECTF--\r
-Test 1 - P1 Value: NULL  P1 Length: Default  P1 Type: Default  P2 Value: NULL P2 Length: Default  P2 Type: Default\r
-bool(true)\r
-Test 2 - P1 Value: ''    P1 Length: Default  P1 Type: Default  P2 Value: ''   P2 Length: Default  P2 Type: Default\r
-bool(true)\r
-Test 3 - P1 Value: 'abc' P1 Length: 0        P1 Type: Default  P2 Value: ''   P2 Length: 0        P2 Type: Default\r
-bool(true)\r
-Test 4 - P1 Value: NULL  P1 Length: -1       P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1       P2 Type:Default\r
-\r
-Warning: oci_execute(): ORA-24816: %s in %s on line %d\r
-bool(false)\r
-Test 5 - P1 Value: NULL  P1 Length: 0        P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0        P2 Type:Default\r
-\r
-Warning: oci_execute(): ORA-24816: %s in %s on line %d\r
-bool(false)\r
-===DONE===\r
+--TEST--
+Bug #72524 (Binding null values triggers ORA-24816 error)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => true);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialize
+
+$stmtarray = array(
+         "CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run test
+
+$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";
+
+echo "Test 1 - P1 Value: NULL  P1 Length: Default  P1 Type: Default  P2 Value: NULL P2 Length: Default  P2 Type: Default\n";
+$stmt = oci_parse($c, $sql);
+
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 2 - P1 Value: ''    P1 Length: Default  P1 Type: Default  P2 Value: ''   P2 Length: Default  P2 Type: Default\n";
+
+$clob = '';
+$varchar2 = '';
+oci_bind_by_name($stmt, ':clob_col', $clob);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 3 - P1 Value: 'abc' P1 Length: 0        P1 Type: Default  P2 Value: ''   P2 Length: 0        P2 Type: Default\n";
+$clob = 'abc';
+$varchar2 = 'abc';
+oci_bind_by_name($stmt, ':clob_col', $clob, 0);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 4 - P1 Value: NULL  P1 Length: -1       P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1       P2 Type:Default\n";
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
+
+var_dump(oci_execute($stmt));
+
+echo "Test 5 - P1 Value: NULL  P1 Length: 0        P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0        P2 Type:Default\n";
+$clob = NULL;
+$varchar2 = NULL;
+oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
+oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
+
+
+var_dump(oci_execute($stmt));
+
+// Cleanup
+
+$stmtarray = array(
+    "DROP TABLE mytable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - P1 Value: NULL  P1 Length: Default  P1 Type: Default  P2 Value: NULL P2 Length: Default  P2 Type: Default
+bool(true)
+Test 2 - P1 Value: ''    P1 Length: Default  P1 Type: Default  P2 Value: ''   P2 Length: Default  P2 Type: Default
+bool(true)
+Test 3 - P1 Value: 'abc' P1 Length: 0        P1 Type: Default  P2 Value: ''   P2 Length: 0        P2 Type: Default
+bool(true)
+Test 4 - P1 Value: NULL  P1 Length: -1       P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1       P2 Type:Default
+
+Warning: oci_execute(): ORA-24816: %s in %s on line %d
+bool(false)
+Test 5 - P1 Value: NULL  P1 Length: 0        P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0        P2 Type:Default
+
+Warning: oci_execute(): ORA-24816: %s in %s on line %d
+bool(false)
+===DONE===
index 371c802ede8c416939a7ce2dd981cd352b6a77bb..e0c896dce199d4d892de661d8bdf8b3856e12059 100644 (file)
@@ -13,7 +13,7 @@ require(dirname(__FILE__).'/skipif.inc');
 
 require dirname(__FILE__)."/connect.inc";
 
-$ora_sql = "DROP TYPE ".$type_name;;
+$ora_sql = "DROP TYPE ".$type_name;
 $statement = oci_parse($c,$ora_sql);
 @oci_execute($statement);
 
index 0a29dc1b9e53b860a0f5726ed0de0e2023adfc5d..0d60054b22e11138dbb3f2335f7ffc52da8583c8 100644 (file)
@@ -29,9 +29,9 @@ for ($i = 0; $i < NUMLOBS; $i++) {
 }
 
 for ($i = 0; $i < NUMLOBS; $i++) {
-       echo "Row $i Size:  " . $row[$i][0]->size() . "\n";;
+       echo "Row $i Size:  " . $row[$i][0]->size() . "\n";
        echo "Pos 1: " . $row[$i][0]->tell() . "\n";
-       echo "Data:  " . $row[$i][0]->read(5) . "\n";;
+       echo "Data:  " . $row[$i][0]->read(5) . "\n";
        echo "Pos 2: " . $row[$i][0]->tell() . "\n";
        echo "Data:  " . $row[$i][0]->read(12) . "\n";
 }
index 28e9401baf4857c8e4347f25aaa171c66b036694..9a17f5db180a1ca28c42515471afc2a09e96c434 100644 (file)
@@ -69,7 +69,7 @@ var_dump($row);
 
 echo "Test 2 Manipulate the data using SimpleXML\n";
 
-$sx = simplexml_load_string((binary)$row[0]->load());
+$sx = simplexml_load_string($row[0]->load());
 $row[0]->free();
 var_dump($sx);
 
@@ -178,4 +178,4 @@ string(%d) "<?xml version="1.0"?>
 %sVClearance>10</VClearance>
 </Warehouse>
 "
-===DONE===
\ No newline at end of file
+===DONE===