Skip to content

Commit 4d936c1

Browse files
author
Tianfang Yang
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents 3069ad8 + f555224 commit 4d936c1

File tree

10 files changed

+116
-108
lines changed

10 files changed

+116
-108
lines changed

ext/oci8/oci8_collection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |

ext/oci8/oci8_interface.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |
@@ -56,13 +56,21 @@ PHP_FUNCTION(oci_register_taf_callback)
5656
}
5757

5858
if (callback) {
59+
#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)
60+
if (!zend_is_callable(callback, 0, 0)) {
61+
callback_name = zend_get_callable_name(callback);
62+
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
63+
zend_string_release(callback_name);
64+
RETURN_FALSE;
65+
}
66+
#else
5967
if (!zend_is_callable(callback, 0, &callback_name)) {
6068
php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
6169
zend_string_release(callback_name);
6270
RETURN_FALSE;
6371
}
64-
6572
zend_string_release(callback_name);
73+
#endif
6674
}
6775

6876
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);

ext/oci8/oci8_lob.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |

ext/oci8/oci8_statement.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |

ext/oci8/php_oci8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |

ext/oci8/php_oci8_int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Stig Sæther Bakken <[email protected]> |
15+
| Authors: Stig Sæther Bakken <[email protected]> |
1616
| Thies C. Arntzen <[email protected]> |
1717
| |
1818
| Collection support by Andy Sautins <[email protected]> |

ext/oci8/tests/bug72524.phpt

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
1-
--TEST--
2-
Bug #72524 (Binding null values triggers ORA-24816 error)
3-
--SKIPIF--
4-
<?php
5-
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
6-
require(dirname(__FILE__).'/skipif.inc');
7-
?>
8-
--FILE--
9-
10-
<?php
11-
12-
require(dirname(__FILE__).'/connect.inc');
13-
14-
// Initialize
15-
16-
$stmtarray = array(
17-
"CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
18-
);
19-
20-
oci8_test_sql_execute($c, $stmtarray);
21-
22-
// Run test
23-
24-
$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";
25-
26-
echo "Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default\n";
27-
$stmt = oci_parse($c, $sql);
28-
29-
$clob = NULL;
30-
$varchar2 = NULL;
31-
oci_bind_by_name($stmt, ':clob_col', $clob);
32-
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
33-
34-
var_dump(oci_execute($stmt));
35-
36-
echo "Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default\n";
37-
38-
$clob = '';
39-
$varchar2 = '';
40-
oci_bind_by_name($stmt, ':clob_col', $clob);
41-
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
42-
43-
var_dump(oci_execute($stmt));
44-
45-
echo "Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default\n";
46-
$clob = 'abc';
47-
$varchar2 = 'abc';
48-
oci_bind_by_name($stmt, ':clob_col', $clob, 0);
49-
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
50-
51-
var_dump(oci_execute($stmt));
52-
53-
echo "Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default\n";
54-
$clob = NULL;
55-
$varchar2 = NULL;
56-
oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
57-
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
58-
59-
var_dump(oci_execute($stmt));
60-
61-
echo "Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default\n";
62-
$clob = NULL;
63-
$varchar2 = NULL;
64-
oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
65-
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
66-
67-
68-
var_dump(oci_execute($stmt));
69-
70-
// Cleanup
71-
72-
$stmtarray = array(
73-
"DROP TABLE mytable"
74-
);
75-
76-
oci8_test_sql_execute($c, $stmtarray);
77-
78-
?>
79-
===DONE===
80-
<?php exit(0); ?>
81-
--EXPECTF--
82-
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
83-
bool(true)
84-
Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
85-
bool(true)
86-
Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
87-
bool(true)
88-
Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default
89-
90-
Warning: oci_execute(): ORA-24816: %s in %s on line %d
91-
bool(false)
92-
Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default
93-
94-
Warning: oci_execute(): ORA-24816: %s in %s on line %d
95-
bool(false)
96-
===DONE===
1+
--TEST--
2+
Bug #72524 (Binding null values triggers ORA-24816 error)
3+
--SKIPIF--
4+
<?php
5+
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
6+
require(dirname(__FILE__).'/skipif.inc');
7+
?>
8+
--FILE--
9+
10+
<?php
11+
12+
require(dirname(__FILE__).'/connect.inc');
13+
14+
// Initialize
15+
16+
$stmtarray = array(
17+
"CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
18+
);
19+
20+
oci8_test_sql_execute($c, $stmtarray);
21+
22+
// Run test
23+
24+
$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";
25+
26+
echo "Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default\n";
27+
$stmt = oci_parse($c, $sql);
28+
29+
$clob = NULL;
30+
$varchar2 = NULL;
31+
oci_bind_by_name($stmt, ':clob_col', $clob);
32+
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
33+
34+
var_dump(oci_execute($stmt));
35+
36+
echo "Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default\n";
37+
38+
$clob = '';
39+
$varchar2 = '';
40+
oci_bind_by_name($stmt, ':clob_col', $clob);
41+
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
42+
43+
var_dump(oci_execute($stmt));
44+
45+
echo "Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default\n";
46+
$clob = 'abc';
47+
$varchar2 = 'abc';
48+
oci_bind_by_name($stmt, ':clob_col', $clob, 0);
49+
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
50+
51+
var_dump(oci_execute($stmt));
52+
53+
echo "Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default\n";
54+
$clob = NULL;
55+
$varchar2 = NULL;
56+
oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
57+
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
58+
59+
var_dump(oci_execute($stmt));
60+
61+
echo "Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default\n";
62+
$clob = NULL;
63+
$varchar2 = NULL;
64+
oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
65+
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
66+
67+
68+
var_dump(oci_execute($stmt));
69+
70+
// Cleanup
71+
72+
$stmtarray = array(
73+
"DROP TABLE mytable"
74+
);
75+
76+
oci8_test_sql_execute($c, $stmtarray);
77+
78+
?>
79+
===DONE===
80+
<?php exit(0); ?>
81+
--EXPECTF--
82+
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
83+
bool(true)
84+
Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
85+
bool(true)
86+
Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
87+
bool(true)
88+
Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default
89+
90+
Warning: oci_execute(): ORA-24816: %s in %s on line %d
91+
bool(false)
92+
Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default
93+
94+
Warning: oci_execute(): ORA-24816: %s in %s on line %d
95+
bool(false)
96+
===DONE===

ext/oci8/tests/coll_019.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require(dirname(__FILE__).'/skipif.inc');
1313

1414
require dirname(__FILE__)."/connect.inc";
1515

16-
$ora_sql = "DROP TYPE ".$type_name;;
16+
$ora_sql = "DROP TYPE ".$type_name;
1717
$statement = oci_parse($c,$ora_sql);
1818
@oci_execute($statement);
1919

ext/oci8/tests/lob_040.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ for ($i = 0; $i < NUMLOBS; $i++) {
2929
}
3030

3131
for ($i = 0; $i < NUMLOBS; $i++) {
32-
echo "Row $i Size: " . $row[$i][0]->size() . "\n";;
32+
echo "Row $i Size: " . $row[$i][0]->size() . "\n";
3333
echo "Pos 1: " . $row[$i][0]->tell() . "\n";
34-
echo "Data: " . $row[$i][0]->read(5) . "\n";;
34+
echo "Data: " . $row[$i][0]->read(5) . "\n";
3535
echo "Pos 2: " . $row[$i][0]->tell() . "\n";
3636
echo "Data: " . $row[$i][0]->read(12) . "\n";
3737
}

ext/oci8/tests/xmltype_02.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var_dump($row);
6969

7070
echo "Test 2 Manipulate the data using SimpleXML\n";
7171

72-
$sx = simplexml_load_string((binary)$row[0]->load());
72+
$sx = simplexml_load_string($row[0]->load());
7373
$row[0]->free();
7474
var_dump($sx);
7575

@@ -178,4 +178,4 @@ string(%d) "<?xml version="1.0"?>
178178
%sVClearance>10</VClearance>
179179
</Warehouse>
180180
"
181-
===DONE===
181+
===DONE===

0 commit comments

Comments
 (0)