Skip to content

Commit ae95644

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix pdo_oci tests for PHP 8.0
2 parents 06f86bf + 3e0f144 commit ae95644

File tree

4 files changed

+62
-73
lines changed

4 files changed

+62
-73
lines changed

ext/pdo/tests/bug_73234.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ if (false == $dir) die('skip no driver');
99
if (str_starts_with(getenv('PDOTEST_DSN'), "firebird")) die('xfail firebird driver does not behave as expected');
1010
require_once $dir . 'pdo_test.inc';
1111
PDOTest::skip();
12+
13+
$db = PDOTest::factory();
14+
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
15+
die("xfail PDO::PARAM_NULL is not honored by OCI driver, related with bug #81586");
16+
}
1217
?>
1318
--FILE--
1419
<?php

ext/pdo/tests/gh8626.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ $dir = getenv('REDIR_TEST_DIR');
77
if (false == $dir) die('skip no driver');
88
require_once $dir . 'pdo_test.inc';
99
PDOTest::skip();
10+
11+
$db = PDOTest::factory();
12+
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
13+
die("xfail OCI driver errorInfo is inconsistent with other PDO drivers");
14+
}
1015
?>
1116
--FILE--
1217
<?php

ext/pdo_oci/tests/pdo_oci_stream_2a.phpt renamed to ext/pdo_oci/tests/pdo_oci_stream_2.phpt

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
PDO OCI: Inserts 1K with 1 number and 2 LOB columns (stress test)
2+
PDO OCI: Insert and fetch 1K records from a table that contains 1 number and 2 LOB columns (stress test)
33
--EXTENSIONS--
44
pdo
55
pdo_oci
@@ -71,6 +71,57 @@ printf("Done\n");
7171
/* Cleanup is done in pdo_oci_stream_2b.phpt */
7272
//$db->exec("drop table pdo_oci_stream_2");
7373

74+
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
75+
76+
// Since each column only has one lob descriptor, the last row is
77+
// shown twice because the lob descriptor for each column is reused in
78+
// the stream
79+
80+
$i = 0;
81+
$j = 9;
82+
$a_val = ord('a');
83+
foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) {
84+
$a = $row['d4_1'];
85+
$a1 = $row['d4_2'];
86+
87+
$str1 = stream_get_contents($a);
88+
$str2 = stream_get_contents($a1);
89+
90+
$str1len = strlen($str1);
91+
$str2len = strlen($str2);
92+
93+
$b = ord($str1[0]);
94+
$b1 = ord($str2[0]);
95+
96+
if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) &&
97+
($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) {
98+
printf("There is a bug!\n");
99+
printf("Col1:\n");
100+
printf("a_val = %d\n", $a_val);
101+
printf("b = %d\n", $b);
102+
printf("i = %d\n", $i);
103+
printf("str1len = %d\n", $str1len);
104+
105+
printf("Col2:\n");
106+
printf("a_val = %d\n", $a_val);
107+
printf("b1 = %d\n", $b1);
108+
printf("j = %d\n", $j);
109+
printf("str2len = %d\n", $str1len);
110+
111+
}
112+
$i++;
113+
if ($i>9)
114+
$i = 0;
115+
$j--;
116+
if ($j<0)
117+
$j = 9;
118+
}
119+
echo "Fetch operation done!\n";
120+
121+
/* Cleanup */
122+
$db->exec("drop table pdo_oci_stream_2");
123+
74124
?>
75125
--EXPECT--
76126
Inserting 1000 Records ... Done
127+
Fetch operation done!

ext/pdo_oci/tests/pdo_oci_stream_2b.phpt

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)