From 01f8d46d452b048a2417c9678edeea9ceaf4f6a0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 11 Dec 2012 17:03:46 +0100 Subject: php 5.5: patch for broken unpack function --- php-wip2.patch | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ php55.spec | 12 +++++++--- 2 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 php-wip2.patch diff --git a/php-wip2.patch b/php-wip2.patch new file mode 100644 index 0000000..91535e9 --- /dev/null +++ b/php-wip2.patch @@ -0,0 +1,75 @@ +From 4d8d5d83fce83c32a04cd8d8cf50d909ab101f38 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 11 Dec 2012 16:30:08 +0100 +Subject: [PATCH] Fixed Bug #63738 unpack: back result with Z format + +Fix result for empty string. +Same output as perl +perl -e 'print unpack("Z2","\0\0");' => "" +perl -e 'print unpack("Z2","A\0");' => "A" +perl -e 'print unpack("Z2","AB\0");' => "AB" +perl -e 'print unpack("Z2","ABC\0");'=> "AB" +--- + ext/standard/pack.c | 3 +-- + ext/standard/tests/strings/pack_Z.phpt | 25 ++++++++++++++++++++++++- + 2 files changed, 25 insertions(+), 3 deletions(-) + +diff --git a/ext/standard/pack.c b/ext/standard/pack.c +index 9894746..0472cb2 100644 +--- a/ext/standard/pack.c ++++ b/ext/standard/pack.c +@@ -729,8 +729,7 @@ PHP_FUNCTION(unpack) + size = len; + + /* Remove everything after the first null */ +- s = 0; +- while (s++ <= len) { ++ for (s=0 ; s < len ; s++) { + if (input[inputpos + s] == pad) + break; + } +diff --git a/ext/standard/tests/strings/pack_Z.phpt b/ext/standard/tests/strings/pack_Z.phpt +index 8a2ee67..4fd007a 100644 +--- a/ext/standard/tests/strings/pack_Z.phpt ++++ b/ext/standard/tests/strings/pack_Z.phpt +@@ -9,9 +9,15 @@ var_dump( + pack("Z4", "foo"), + pack("Z*", "foo"), + unpack("Z*", "foo\0\rbar\0 \t\r\n"), +- unpack("Z9", "foo\0\rbar\0 \t\r\n") ++ unpack("Z9", "foo\0\rbar\0 \t\r\n"), ++ unpack("Z2", "\0"), ++ unpack("Z2", "\0\0"), ++ unpack("Z2", "A\0"), ++ unpack("Z2", "AB\0"), ++ unpack("Z2", "ABC") + ); + --EXPECTF-- ++Warning: unpack(): Type Z: not enough input, need 2, have 1 in %s on line %d + string(0) "" + string(5) "foo%c%c" + string(4) "foo%c" +@@ -25,3 +31,20 @@ array(1) { + [1]=> + string(3) "foo" + } ++bool(false) ++array(1) { ++ [1]=> ++ string(0) "" ++} ++array(1) { ++ [1]=> ++ string(1) "A" ++} ++array(1) { ++ [1]=> ++ string(2) "AB" ++} ++array(1) { ++ [1]=> ++ string(2) "AB" ++} +-- +1.7.11.5 + diff --git a/php55.spec b/php55.spec index 0b93ec6..ef51f2a 100644 --- a/php55.spec +++ b/php55.spec @@ -68,7 +68,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php Version: 5.5.0 %if 0%{?snapdate:1}%{?rcver:1} -Release: 0.7.%{?snapdate}%{?rcver}%{?dist} +Release: 0.8.%{?snapdate}%{?rcver}%{?dist} %else Release: 2%{?dist} %endif @@ -127,7 +127,9 @@ Patch91: php-5.3.7-oci8conf.patch # WIP dtrace patch # https://bugs.php.net/bug.php?id=63706 -Patch99: php-wip.patch +Patch100: php-wip.patch +# https://bugs.php.net/bug.php?id=63738 +Patch101: php-wip2.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -787,7 +789,8 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1 %patch91 -p1 -b .remi-oci8 -%patch99 -p0 -b .wip +%patch100 -p0 -b .wip +%patch101 -p1 -b .wip2 # Prevent %%doc confusion over LICENSE files cp Zend/LICENSE Zend/ZEND_LICENSE @@ -1643,6 +1646,9 @@ fi %changelog +* Tue Dec 11 2012 Remi Collet 5.5.0-0.8.201212110630 +- patch for unpack + * Tue Dec 11 2012 Remi Collet 5.5.0-0.7.201212110630 - prevent php_config.h changes across (otherwise identical) rebuilds - drop "Configure Command" from phpinfo output -- cgit