From d522643c1fa711b4530c105da0cd2b4a86fce18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 19 Jul 2022 12:05:10 +0200 Subject: [PATCH 1/4] Fix pdo_oci tests for PHP 8.0 --- ext/pdo/tests/bug_73234.phpt | 5 ++ ext/pdo/tests/gh8626.phpt | 5 ++ ...i_stream_2a.phpt => pdo_oci_stream_2.phpt} | 53 +++++++++++++- ext/pdo_oci/tests/pdo_oci_stream_2b.phpt | 70 ------------------- 4 files changed, 62 insertions(+), 71 deletions(-) rename ext/pdo_oci/tests/{pdo_oci_stream_2a.phpt => pdo_oci_stream_2.phpt} (60%) delete mode 100644 ext/pdo_oci/tests/pdo_oci_stream_2b.phpt diff --git a/ext/pdo/tests/bug_73234.phpt b/ext/pdo/tests/bug_73234.phpt index 451cc4849c42a..e3e3c0b2b8090 100644 --- a/ext/pdo/tests/bug_73234.phpt +++ b/ext/pdo/tests/bug_73234.phpt @@ -7,6 +7,11 @@ $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); + +$db = PDOTest::factory(); +if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { + die("xfail PDO::PARAM_NULL is not honored by OCI driver, related with bug #81586"); +} ?> --FILE-- getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { + die("xfail OCI driver errorInfo is inconsistent with other PDO drivers"); +} ?> --FILE-- exec("drop table pdo_oci_stream_2"); +$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams + +// Since each column only has one lob descriptor, the last row is +// shown twice because the lob descriptor for each column is reused in +// the stream + +$i = 0; +$j = 9; +$a_val = ord('a'); +foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) { + $a = $row['d4_1']; + $a1 = $row['d4_2']; + + $str1 = stream_get_contents($a); + $str2 = stream_get_contents($a1); + + $str1len = strlen($str1); + $str2len = strlen($str2); + + $b = ord($str1[0]); + $b1 = ord($str2[0]); + + if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) && + ($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) { + printf("There is a bug!\n"); + printf("Col1:\n"); + printf("a_val = %d\n", $a_val); + printf("b = %d\n", $b); + printf("i = %d\n", $i); + printf("str1len = %d\n", $str1len); + + printf("Col2:\n"); + printf("a_val = %d\n", $a_val); + printf("b1 = %d\n", $b1); + printf("j = %d\n", $j); + printf("str2len = %d\n", $str1len); + + } + $i++; + if ($i>9) + $i = 0; + $j--; + if ($j<0) + $j = 9; +} +echo "Fetch operation done!\n"; + +/* Cleanup */ +$db->exec("drop table pdo_oci_stream_2"); + ?> --EXPECT-- Inserting 1000 Records ... Done +Fetch operation done! diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt deleted file mode 100644 index de09c4872883b..0000000000000 --- a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -PDO OCI: Fetches 1K records from a table that contains 1 number and 2 LOB columns (stress test) ---SKIPIF-- - ---FILE-- -setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams - -// Since each column only has one lob descriptor, the last row is -// shown twice because the lob descriptor for each column is reused in -// the stream - -$i = 0; -$j = 9; -$a_val = ord('a'); -foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) { - $a = $row['d4_1']; - $a1 = $row['d4_2']; - - $str1 = stream_get_contents($a); - $str2 = stream_get_contents($a1); - - $str1len = strlen($str1); - $str2len = strlen($str2); - - $b = ord($str1[0]); - $b1 = ord($str2[0]); - - if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) && - ($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) { - printf("There is a bug!\n"); - printf("Col1:\n"); - printf("a_val = %d\n", $a_val); - printf("b = %d\n", $b); - printf("i = %d\n", $i); - printf("str1len = %d\n", $str1len); - - printf("Col2:\n"); - printf("a_val = %d\n", $a_val); - printf("b1 = %d\n", $b1); - printf("j = %d\n", $j); - printf("str2len = %d\n", $str1len); - - } - $i++; - if ($i>9) - $i = 0; - $j--; - if ($j<0) - $j = 9; -} -echo "Fetch operation done!\n"; - -/* Cleanup */ -$db->exec("drop table pdo_oci_stream_2"); - -?> ---EXPECT-- -Fetch operation done! From c7e37af20ae7d76ceaa93b6bae98ec83353d0f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 19 Jul 2022 17:35:54 +0200 Subject: [PATCH 2/4] xfail pdo_039.phpt test for Oracle --- ext/pdo/tests/pdo_039.phpt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/pdo/tests/pdo_039.phpt b/ext/pdo/tests/pdo_039.phpt index ecde2428769cc..ad5aa5bf6744d 100644 --- a/ext/pdo/tests/pdo_039.phpt +++ b/ext/pdo/tests/pdo_039.phpt @@ -8,6 +8,11 @@ $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); + +$db = PDOTest::factory(); +if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { + die("xfail OCI driver errorInfo is inconsistent with other PDO drivers"); +} ?> --FILE-- getAttribute(PDO::ATTR_DRIVER_NAME) === 'oci') { + $query .= ' FROM DUAL'; +} var_dump($conn->errorCode()); $stmt = $conn->prepare($query); From cf3911a30e367d8b745d4049159c7d2cd5085bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 19 Jul 2022 17:36:22 +0200 Subject: [PATCH 3/4] fix deprecation warning in pdo_oci test --- ext/pdo_oci/tests/pdo_oci_quote1.phpt | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/ext/pdo_oci/tests/pdo_oci_quote1.phpt b/ext/pdo_oci/tests/pdo_oci_quote1.phpt index 024625a181fc4..ea2a5468dbd5b 100644 --- a/ext/pdo_oci/tests/pdo_oci_quote1.phpt +++ b/ext/pdo_oci/tests/pdo_oci_quote1.phpt @@ -21,7 +21,7 @@ $stmt = $db->prepare('select * from poq_tab'); // The intent is that the fetched data be identical to the unquoted string. // Remember!: use bind variables instead of PDO->quote() -$a = array(null, "", "a", "ab", "abc", "ab'cd", "a\b\n", "'", "''", "a'", "'z", "a''b", '"'); +$a = array("", "a", "ab", "abc", "ab'cd", "a\b\n", "'", "''", "a'", "'z", "a''b", '"'); foreach ($a as $u) { $q = $db->quote($u); echo "Unquoted : "; @@ -42,15 +42,6 @@ echo "Done\n"; ?> --EXPECT-- -Unquoted : NULL -Quoted : string(2) "''" -array(1) { - [0]=> - array(1) { - ["t"]=> - NULL - } -} Unquoted : string(0) "" Quoted : string(2) "''" array(1) { From 8df93d4ea821a5cfdddf4ee39ed2ebed0b7655b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 21 Jul 2022 13:11:27 +0200 Subject: [PATCH 4/4] fix pdo_039.phpt --- ext/pdo/tests/pdo_039.phpt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ext/pdo/tests/pdo_039.phpt b/ext/pdo/tests/pdo_039.phpt index ad5aa5bf6744d..5004fc40d651d 100644 --- a/ext/pdo/tests/pdo_039.phpt +++ b/ext/pdo/tests/pdo_039.phpt @@ -8,11 +8,6 @@ $dir = getenv('REDIR_TEST_DIR'); if (false == $dir) die('skip no driver'); require_once $dir . 'pdo_test.inc'; PDOTest::skip(); - -$db = PDOTest::factory(); -if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { - die("xfail OCI driver errorInfo is inconsistent with other PDO drivers"); -} ?> --FILE-- errorCode()); + $query = 'SELECT 1'; if ($conn->getAttribute(PDO::ATTR_DRIVER_NAME) === 'oci') { $query .= ' FROM DUAL'; } - var_dump($conn->errorCode()); -$stmt = $conn->prepare($query); var_dump($conn->errorCode()); +$stmt = $conn->prepare($query); +var_dump($conn->errorCode()); var_dump($stmt->errorCode()); + $stmt->execute(); var_dump($stmt->errorCode()); +var_dump($stmt->errorCode()); ?> --EXPECT-- NULL string(5) "00000" +string(5) "00000" +string(5) "00000" NULL string(5) "00000" +string(5) "00000"