From 27b3eca90b74939eac8b9c6b1c7ef001fa65aa6f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 2 Sep 2020 10:02:38 +0200 Subject: add upstream patch for test suite add patch for PHP 8.0.0beta3 from https://github.com/igbinary/igbinary/pull/284 --- igbinary-tests.patch | 388 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100644 igbinary-tests.patch (limited to 'igbinary-tests.patch') diff --git a/igbinary-tests.patch b/igbinary-tests.patch new file mode 100644 index 0000000..8df5caa --- /dev/null +++ b/igbinary-tests.patch @@ -0,0 +1,388 @@ +From: Tyson Andre +Date: Sun, 23 Aug 2020 17:35:38 -0400 +Subject: [PATCH] Update tests for php 8.0 + +Fixes #278 +--- + .appveyor.yml | 15 +- + .travis.yml | 9 +- + ci/run-tests-parallel.php | 486 ++++++++++++++++++++++------------ + package.xml | 23 +- + src/php7/igbinary.h | 2 +- + tests/igbinary_009b.phpt | 3 + + tests/igbinary_009b_php8.phpt | 114 ++++++++ + tests/igbinary_026.phpt | 5 +- + tests/igbinary_026_php8.phpt | 100 +++++++ + tests/igbinary_026b.phpt | 3 + + tests/igbinary_026b_php8.phpt | 86 ++++++ + 11 files changed, 663 insertions(+), 183 deletions(-) + create mode 100644 tests/igbinary_009b_php8.phpt + create mode 100644 tests/igbinary_026_php8.phpt + create mode 100644 tests/igbinary_026b_php8.phpt + +diff --git a/tests/igbinary_009b.phpt b/tests/igbinary_009b.phpt +index 75fb2be..6322011 100644 +--- a/tests/igbinary_009b.phpt ++++ b/tests/igbinary_009b.phpt +@@ -5,6 +5,9 @@ Check for reference serialization (Original example, not using var_dump) + if (!extension_loaded('igbinary')) { + echo "skip no igbinary"; + } ++if (PHP_MAJOR_VERSION > 7) { ++ echo "skip requires php 7.x\n"; ++} + --INI-- + pcre.jit=0 + --FILE-- +diff --git a/tests/igbinary_009b_php8.phpt b/tests/igbinary_009b_php8.phpt +new file mode 100644 +index 0000000..483576a +--- /dev/null ++++ b/tests/igbinary_009b_php8.phpt +@@ -0,0 +1,114 @@ ++--TEST-- ++Check for reference serialization in php 8 (Original example, not using var_dump) ++--SKIPIF-- ++ ++ &array(1) { ++ [0]=> ++ array(1) { ++ [0]=> ++ *RECURSION* ++ } ++ } ++} ++ ++Expected ++array(1) { ++ [0]=> ++ &array(1) { ++ [0]=> ++ *RECURSION* ++ } ++} ++ ++(Was normalized) ++cyclic $a = array(array(&$a)); $a[0] - testing functionality ++14010600251401060014010600250101 ++OK ++But var dump differs: ++Actual: ++array(1) { ++ [0]=> ++ &array(1) { ++ [0]=> ++ array(1) { ++ [0]=> ++ *RECURSION* ++ } ++ } ++} ++ ++Expected ++array(1) { ++ [0]=> ++ &array(1) { ++ [0]=> ++ *RECURSION* ++ } ++} ++ ++(Was normalized) +\ No newline at end of file +diff --git a/tests/igbinary_026.phpt b/tests/igbinary_026.phpt +index 950a218..c3f4386 100644 +--- a/tests/igbinary_026.phpt ++++ b/tests/igbinary_026.phpt +@@ -4,9 +4,12 @@ Cyclic array test + report_memleaks=0 + --SKIPIF-- + 7) { ++ echo "skip requires php 7.x\n"; ++} + --FILE-- + array( ++ 'b' => 'c', ++ 'd' => 'e' ++ ), ++); ++ ++$a['f'] = &$a; ++ ++test('array', $a, false); ++ ++$a = array("foo" => &$b); ++$b = array(1, 2, $a); ++ ++$exp = $a; ++$act = igbinary_unserialize(igbinary_serialize($a)); ++ ++ob_start(); ++var_dump($exp); ++$dump_exp = ob_get_clean(); ++ob_start(); ++var_dump($act); ++$dump_act = ob_get_clean(); ++ ++if ($dump_act !== $dump_exp) { ++ echo "Var dump differs:\nActual:\n", $dump_act, "\nExpected:\n", $dump_exp, "\n"; ++} else { ++ echo "Var dump OK\n"; ++} ++ ++$act['foo'][1] = 'test value'; ++$exp['foo'][1] = 'test value'; ++if ($act['foo'][1] !== $act['foo'][2]['foo'][1]) { ++ echo "Recursive elements differ:\n"; ++ echo "Actual\n"; ++ var_dump($act); ++ var_dump($act['foo']); ++ echo "Expected\n"; ++ var_dump($exp); ++ var_dump($exp['foo']); ++} ++ ++?> ++--EXPECT-- ++array ++140211016114021101621101631101641101651101662514020e0001010e05250102 ++OK ++Var dump differs: ++Actual: ++array(1) { ++ ["foo"]=> ++ &array(3) { ++ [0]=> ++ int(1) ++ [1]=> ++ int(2) ++ [2]=> ++ array(1) { ++ ["foo"]=> ++ *RECURSION* ++ } ++ } ++} ++ ++Expected: ++array(1) { ++ ["foo"]=> ++ &array(3) { ++ [0]=> ++ int(1) ++ [1]=> ++ int(2) ++ [2]=> ++ *RECURSION* ++ } ++} +diff --git a/tests/igbinary_026b.phpt b/tests/igbinary_026b.phpt +index ba17ae3..6d0ad0d 100644 +--- a/tests/igbinary_026b.phpt ++++ b/tests/igbinary_026b.phpt +@@ -7,6 +7,9 @@ report_memleaks=0 + if (!extension_loaded('igbinary')) { + echo "skip no igbinary"; + } ++if (PHP_MAJOR_VERSION > 7) { ++ echo "skip requires php 7.x\n"; ++} + --FILE-- + &$b); ++$b = array(1, 2, $a); ++ ++/* all three statements below should produce same output however PHP stock ++ * unserialize/serialize produces different output (5.2.16). I consider this is ++ * a PHP bug. - Oleg Grenrus ++ */ ++ ++/* NOTE: This is different in php 8 because igbinary_unserialize() is declared to return a reference, not a value */ ++ ++//$k = $a; ++//$k = unserialize(serialize($a)); ++$k = igbinary_unserialize(igbinary_serialize($a)); ++ ++function check($a, $k) { ++ ob_start(); ++ var_dump($a); ++ $a_str = ob_get_clean(); ++ ob_start(); ++ var_dump($k); ++ $k_str = ob_get_clean(); ++ ++ if ($a_str !== $k_str) { ++ echo "Output differs\n"; ++ echo "Expected:\n", $a_str, "\n"; ++ echo "Actual:\n", $k_str, "\n"; ++ } else { ++ echo "OK\n"; ++ } ++} ++ ++check($a, $k); ++ ++$a["foo"][2]["foo"][1] = "b"; ++$k["foo"][2]["foo"][1] = "b"; ++ ++check($a, $k); ++ ++?> ++--EXPECT-- ++Output differs ++Expected: ++array(1) { ++ ["foo"]=> ++ &array(3) { ++ [0]=> ++ int(1) ++ [1]=> ++ int(2) ++ [2]=> ++ *RECURSION* ++ } ++} ++ ++Actual: ++array(1) { ++ ["foo"]=> ++ &array(3) { ++ [0]=> ++ int(1) ++ [1]=> ++ int(2) ++ [2]=> ++ array(1) { ++ ["foo"]=> ++ *RECURSION* ++ } ++ } ++} ++ ++OK +\ No newline at end of file -- cgit