diff options
-rw-r--r-- | 284.patch | 37 | ||||
-rw-r--r-- | PHPINFO | 2 | ||||
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | igbinary-tests.patch | 388 | ||||
-rw-r--r-- | php-pecl-igbinary.spec | 15 |
5 files changed, 8 insertions, 436 deletions
diff --git a/284.patch b/284.patch deleted file mode 100644 index 7462b9c..0000000 --- a/284.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 46e8fa27851693877c32d0dd1239789bf2a78865 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Wed, 2 Sep 2020 09:50:49 +0200 -Subject: [PATCH] fix for 8.0.0beta3 - ---- - src/php7/igbinary.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/php7/igbinary.c b/src/php7/igbinary.c -index 992867a..d62e8dd 100644 ---- a/src/php7/igbinary.c -+++ b/src/php7/igbinary.c -@@ -2751,7 +2751,11 @@ inline static int igbinary_unserialize_object(struct igbinary_unserialize_data * - break; - } - if (incomplete_class) { -+#if PHP_VERSION_ID >= 80000 -+ php_store_class_name(z, class_name); -+#else - php_store_class_name(z, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); -+#endif - #if PHP_VERSION_ID >= 70400 - } else { - if (zend_hash_str_exists(&ce->function_table, "__unserialize", sizeof("__unserialize") - 1)) { -@@ -2802,7 +2806,11 @@ inline static int igbinary_unserialize_object(struct igbinary_unserialize_data * - } - - if (incomplete_class) { -+#if PHP_VERSION_ID >= 80000 -+ php_store_class_name(z, class_name); -+#else - php_store_class_name(z, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); -+#endif - } - struct igbinary_value_ref *ref = &IGB_REF_VAL_2(igsd, ref_n); - if ((flags & WANT_REF) != 0) { @@ -2,7 +2,7 @@ igbinary igbinary support => enabled -igbinary version => 3.1.4 +igbinary version => 3.1.5 igbinary APCu serializer ABI => 0 igbinary session support => yes @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #77 igbinary version 3.1.4 ] { +Extension [ <persistent> extension #77 igbinary version 3.1.5 ] { - Dependencies { Dependency [ standard (Required) ] diff --git a/igbinary-tests.patch b/igbinary-tests.patch deleted file mode 100644 index 8df5caa..0000000 --- a/igbinary-tests.patch +++ /dev/null @@ -1,388 +0,0 @@ -From: Tyson Andre <tysonandre775@hotmail.com> -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-- -+<?php -+if (!extension_loaded('igbinary')) { -+ echo "skip no igbinary"; -+} -+if (PHP_MAJOR_VERSION < 8) { -+ echo "skip requires php 8.0+\n"; -+} -+--INI-- -+pcre.jit=0 -+--FILE-- -+<?php -+error_reporting(E_ALL|E_STRICT); -+// Verify that $type[0] is the same zval as $type[0][0][0], but different from $type[0] -+function test_cyclic2($type, $variable) { -+ $serialized = igbinary_serialize($variable); -+ $unserialized = igbinary_unserialize($serialized); -+ echo $type, "\n"; -+ echo substr(bin2hex($serialized), 8), "\n"; -+ // Can't use === or == on two recursive arrays in some cases -+ echo array_keys($unserialized) === array_keys($variable) && array_keys($unserialized[0]) === array_keys($variable[0]) ? 'OK' : 'ERROR', "\n"; -+ ob_start(); -+ var_dump($variable); -+ $dump_exp = ob_get_clean(); -+ ob_start(); -+ var_dump($unserialized); -+ $dump_act = ob_get_clean(); -+ if (preg_replace('/&array/', 'array', $dump_act) !== preg_replace('/&array/', 'array', $dump_exp)) { -+ echo "But var dump differs:\nActual:\n", $dump_act, "\nExpected\n", $dump_exp, "\n"; -+ echo "(Was normalized)\n"; -+ } -+ -+ if (!isset($unserialized[0]) || count($unserialized) != 1) { -+ printf("Unexpected keys: %s\n", array_keys($unserialized)); -+ return; -+ } else if (!is_array($unserialized)) { -+ printf("\$a[0] is not an array, it is %s", gettype($unserialized)); -+ return; -+ } -+ // Set a key, check for the presence of the key 2 levels deeper (Should find it) and 1 level deeper (Should not find it) -+ $unserialized[0]['test'] = 'foo'; -+ if ($unserialized[0][0][0]['test'] !== 'foo') { -+ echo "Expected the unserialized array to be cyclic\n"; -+ } -+ if (isset($unserialized[0][0]['test'])) { -+ echo "Expected the unserialized array to be cyclic AND of cycle depth 2, but cycle depth is 1\n"; -+ } -+} -+$a = [null]; -+$b = [&$a]; -+$a[0] = &$b; -+// 1401060025140106002514010600250101 could also be serialized as 14010600251401060014010600250101 if we normalized the references which only occurred once in the serialization -+// (Replace middle &array(&$a) with array(&$array), i.e. second 2514 with 14) -+test_cyclic2('cyclic $a = array(&array(&$a)) - testing functionality', $a); -+unset($a); -+$a = null; -+$a = [[&$a]]; -+test_cyclic2('cyclic $a = array(array(&$a)); $a[0] - testing functionality', $a[0]); -+// $a serializes as 140106001401060025140106000101 - This is a bug, probably exists in php5 as well. -+--EXPECT-- -+cyclic $a = array(&array(&$a)) - testing functionality -+1401060025140106002514010600250101 -+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) -+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-- - <?php --if(!extension_loaded('igbinary')) { -+if (!extension_loaded('igbinary')) { - echo "skip no igbinary"; - } -+if (PHP_MAJOR_VERSION > 7) { -+ echo "skip requires php 7.x\n"; -+} - --FILE-- - <?php - -diff --git a/tests/igbinary_026_php8.phpt b/tests/igbinary_026_php8.phpt -new file mode 100644 -index 0000000..91313d1 ---- /dev/null -+++ b/tests/igbinary_026_php8.phpt -@@ -0,0 +1,100 @@ -+--TEST-- -+Cyclic array test -+--INI-- -+report_memleaks=0 -+--SKIPIF-- -+<?php -+if (!extension_loaded('igbinary')) { -+ echo "skip no igbinary\n"; -+} -+if (PHP_MAJOR_VERSION < 8) { -+ echo "skip requires php 8.0+\n"; -+} -+--FILE-- -+<?php -+ -+function test($type, $variable, $test) { -+ $serialized = igbinary_serialize($variable); -+ $unserialized = igbinary_unserialize($serialized); -+ -+ echo $type, "\n"; -+ echo substr(bin2hex($serialized), 8), "\n"; -+ echo !$test || $unserialized == $variable ? 'OK' : 'ERROR', "\n"; -+} -+ -+$a = array( -+ 'a' => 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-- - <?php - -diff --git a/tests/igbinary_026b_php8.phpt b/tests/igbinary_026b_php8.phpt -new file mode 100644 -index 0000000..b5ffa9c ---- /dev/null -+++ b/tests/igbinary_026b_php8.phpt -@@ -0,0 +1,86 @@ -+--TEST-- -+Cyclic array test 2 -+--INI-- -+report_memleaks=0 -+--SKIPIF-- -+<?php -+if (!extension_loaded('igbinary')) { -+ echo "skip no igbinary\n"; -+} -+if (PHP_MAJOR_VERSION < 8) { -+ echo "skip requires php 8\n"; -+} -+--FILE-- -+<?php -+ -+$a = array("foo" => &$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 diff --git a/php-pecl-igbinary.spec b/php-pecl-igbinary.spec index 230422b..03c6e70 100644 --- a/php-pecl-igbinary.spec +++ b/php-pecl-igbinary.spec @@ -25,7 +25,7 @@ #global gh_date 20161018 %global ini_name 40-%{pecl_name}.ini -%global upstream_version 3.1.4 +%global upstream_version 3.1.5 #global upstream_prever a1 Summary: Replacement for the standard PHP serializer @@ -35,15 +35,12 @@ Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 0.12.%{gh_date}.%{gh_short}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Source0: https://github.com/%{pecl_name}/%{pecl_name}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz %else -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz %endif License: BSD URL: https://pecl.php.net/package/igbinary -Patch0: igbinary-tests.patch -Patch1: https://patch-diff.githubusercontent.com/raw/igbinary/igbinary/pull/284.patch - BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-devel > 7 @@ -86,7 +83,6 @@ Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "8.0" Obsoletes: php80-pecl-%{pecl_name} <= %{version} @@ -147,9 +143,6 @@ mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS %{?_licensedir:sed -e '/COPYING/s/role="doc"/role="src"/' -i package.xml} cd NTS -%patch0 -p1 -b .up -%patch1 -p1 -b .pr - # Check version subdir="php$(%{__php} -r 'echo (PHP_MAJOR_VERSION < 7 ? 5 : 7);')" extver=$(sed -n '/#define PHP_IGBINARY_VERSION/{s/.* "//;s/".*$//;p}' src/$subdir/igbinary.h) @@ -308,6 +301,10 @@ fi %changelog +* Thu Sep 3 2020 Remi Collet <remi@remirepo.net> - 3.1.5-1 +- update to 3.1.5 +- drop patch merged upstream + * Wed Sep 2 2020 Remi Collet <remi@remirepo.net> - 3.1.4-2 - add upstream patch for test suite - add patch for PHP 8.0.0beta3 from |