summaryrefslogtreecommitdiffstats
path: root/e24aca97b8925ac9d21f718c0e38274bde949866.patch
diff options
context:
space:
mode:
Diffstat (limited to 'e24aca97b8925ac9d21f718c0e38274bde949866.patch')
-rw-r--r--e24aca97b8925ac9d21f718c0e38274bde949866.patch186
1 files changed, 186 insertions, 0 deletions
diff --git a/e24aca97b8925ac9d21f718c0e38274bde949866.patch b/e24aca97b8925ac9d21f718c0e38274bde949866.patch
new file mode 100644
index 0000000..4d6e444
--- /dev/null
+++ b/e24aca97b8925ac9d21f718c0e38274bde949866.patch
@@ -0,0 +1,186 @@
+From e24aca97b8925ac9d21f718c0e38274bde949866 Mon Sep 17 00:00:00 2001
+From: Tyson Andre <tysonandre775@hotmail.com>
+Date: Sat, 11 Apr 2020 15:14:41 -0400
+Subject: [PATCH] Fix 2 of the test failures in php8
+
+serialize() started throwing an exception in later releases of php 7.4
+for uninitialized typed properties, so these no longer need tests of
+unserialization.
+
+The way php serializes floats (avoiding losing precision when
+unserializing) seems to have changed.
+---
+ tests/__serialize_015.phpt | 1 -
+ tests/__serialize_015_php8.phpt | 58 ---------------------------------
+ tests/igbinary_044.phpt | 36 ++++++++++----------
+ 3 files changed, 18 insertions(+), 77 deletions(-)
+ delete mode 100644 tests/__serialize_015_php8.phpt
+
+diff --git a/tests/__serialize_015.phpt b/tests/__serialize_015.phpt
+index 0610e50..66816ed 100644
+--- a/tests/__serialize_015.phpt
++++ b/tests/__serialize_015.phpt
+@@ -3,7 +3,6 @@ __serialize() mechanism (015): Uninitialized properties from __sleep should thro
+ --SKIPIF--
+ <?php
+ if (PHP_VERSION_ID < 70400) { echo "skip __serialize/__unserialize not supported in php < 7.4 for compatibility with igbinary_serialize()"; }
+-if (PHP_VERSION_ID >= 80000) { echo "skip different error message format"; }
+ ?>
+ --FILE--
+ <?php
+diff --git a/tests/__serialize_015_php8.phpt b/tests/__serialize_015_php8.phpt
+deleted file mode 100644
+index 8eda7b0..0000000
+--- a/tests/__serialize_015_php8.phpt
++++ /dev/null
+@@ -1,58 +0,0 @@
+---TEST--
+-__serialize() mechanism (015): Uninitialized properties from __sleep can be serialized and unserialized
+---SKIPIF--
+-<?php if (PHP_VERSION_ID < 80000) { echo "skip __serialize/__unserialize error message different in php < 8"; } ?>
+---FILE--
+-<?php
+-error_reporting(E_ALL);
+-set_error_handler(function ($errno, $message) {
+- echo $message . "\n";
+-});
+-class OSI {
+- public stdClass $o;
+- public string $s;
+- public ?int $i;
+- public float $f;
+- public function __sleep() {
+- return ['o', 's', 'i'];
+- }
+-}
+-// 00000002 -- header
+-// 17 03 4d79436c617373 -- object of type "MyClass"
+-// 14 03 000000 -- with 3 uninitialized properties
+-$m = new OSI();
+-var_dump($m);
+-var_dump($s = serialize($m));
+-try {
+- var_dump(unserialize($s));
+-} catch (Error $e) {
+- // TODO: Double check if this is a deliberate design decision.
+- echo "unserialize: {$e->getMessage()}\n";
+-}
+-var_dump(bin2hex($s = igbinary_serialize($m)));
+-try {
+- var_dump(igbinary_unserialize($s));
+-} catch (Error $e) {
+- echo "igbinary_unserialize: {$e->getMessage()}\n";
+-}
+---EXPECT--
+-object(OSI)#2 (0) {
+- ["o"]=>
+- uninitialized(stdClass)
+- ["s"]=>
+- uninitialized(string)
+- ["i"]=>
+- uninitialized(?int)
+- ["f"]=>
+- uninitialized(float)
+-}
+-serialize(): "o" returned as member variable from __sleep() but does not exist
+-serialize(): "s" returned as member variable from __sleep() but does not exist
+-serialize(): "i" returned as member variable from __sleep() but does not exist
+-string(44) "O:3:"OSI":3:{s:1:"o";N;s:1:"s";N;s:1:"i";N;}"
+-unserialize: Cannot assign null to property OSI::$o of type stdClass
+-igbinary_serialize(): "o" returned as member variable from __sleep() but does not exist
+-igbinary_serialize(): "s" returned as member variable from __sleep() but does not exist
+-igbinary_serialize(): "i" returned as member variable from __sleep() but does not exist
+-string(46) "0000000217034f5349140311016f001101730011016900"
+-igbinary_unserialize: Cannot assign null to property OSI::$o of type stdClass
+\ No newline at end of file
+diff --git a/tests/igbinary_044.phpt b/tests/igbinary_044.phpt
+index bcf1c89..1d37aa2 100644
+--- a/tests/igbinary_044.phpt
++++ b/tests/igbinary_044.phpt
+@@ -67,50 +67,50 @@ test('double min', -1.7976931348623157e308);
+
+ --EXPECTF--
+ double subnormal:
+-float(-4.9445841251603E-314)
+-float(-4.9445841251603E-314)
++float(-4.944584125%S-314)
++float(-4.944584125%S-314)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 1000000000000000000000000000001001010100100001010011000101110110
+
+ double 1 max subnormal:
+-float(2.2250738585072E-308)
+-float(2.2250738585072E-308)
++float(2.2250738585072%SE-308)
++float(2.2250738585072%SE-308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 0000000000001111111111111111111111111111111111111111111111111111
+
+ double 2 max subnormal:
+-float(2.2250738585072E-308)
+-float(2.2250738585072E-308)
++float(2.2250738585072%SE-308)
++float(2.2250738585072%SE-308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 0000000000001111111111111111111111111111111111111111111111111111
+
+ double 3 max subnormal:
+-float(2.2250738585072E-308)
+-float(2.2250738585072E-308)
++float(2.2250738585072%SE-308)
++float(2.2250738585072%SE-308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ ACCEPTABLE
+
+ double 4 max subnormal:
+-float(2.2250738585072E-308)
+-float(2.2250738585072E-308)
++float(2.2250738585072%SE-308)
++float(2.2250738585072%SE-308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ ACCEPTABLE
+
+ double 5 max subnormal:
+-float(2.2250738585072E-308)
+-float(2.2250738585072E-308)
++float(2.2250738585072%SE-308)
++float(2.2250738585072%SE-308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 0000000000010000000000000000000000000000000000000000000000000000
+
+ double min subnormal:
+-float(-4.9406564584125E-324)
+-float(-4.9406564584125E-324)
++float(-%SE-324)
++float(-%SE-324)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 1000000000000000000000000000000000000000000000000000000000000001
+@@ -123,8 +123,8 @@ float(-1.79769E+308)
+ 1111111111101111111111111111110001010111110010101000001010101110
+
+ double max:
+-float(1.7976931348623E+308)
+-float(1.7976931348623E+308)
++float(1.7976931348623%SE+308)
++float(1.7976931348623%SE+308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 0111111111101111111111111111111111111111111111111111111111111111
+@@ -137,8 +137,8 @@ float(-2.225E-308)
+ 1000000000001111111111111101110100110001101000000000110001101101
+
+ double min:
+-float(-1.7976931348623E+308)
+-float(-1.7976931348623E+308)
++float(-1.7976931348623%SE+308)
++float(-1.7976931348623%SE+308)
+ 6 5 4 3 2 1
+ 3210987654321098765432109876543210987654321098765432109876543210
+ 1111111111101111111111111111111111111111111111111111111111111111