Skip to content

Commit 3058925

Browse files
mvorisekkocsismate
authored andcommitted
Fix pdo_oci tests for PHP 8.0
1 parent 6027d44 commit 3058925

File tree

4 files changed

+62
-71
lines changed

4 files changed

+62
-71
lines changed

ext/pdo/tests/bug_73234.phpt

+5
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 PDO::PARAM_NULL is not honored by OCI driver, related with bug #81586");
14+
}
1015
?>
1116
--FILE--
1217
<?php

ext/pdo/tests/gh8626.phpt

+5
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

+52-1
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
--SKIPIF--
44
<?php
55
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
@@ -69,6 +69,57 @@ printf("Done\n");
6969
/* Cleanup is done in pdo_oci_stream_2b.phpt */
7070
//$db->exec("drop table pdo_oci_stream_2");
7171

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

ext/pdo_oci/tests/pdo_oci_stream_2b.phpt

-70
This file was deleted.

0 commit comments

Comments
 (0)