From: Ilia Alshanetsky Date: Tue, 12 May 2009 12:35:45 +0000 (+0000) Subject: MFB: Fixed bug #47564 (unpacking unsigned long 32bit bit endian returns X-Git-Tag: php-5.2.10RC1~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb7437d7f1db7ed48b3c85668d12539a87534306;p=php MFB: Fixed bug #47564 (unpacking unsigned long 32bit bit endian returns wrong result) --- diff --git a/NEWS b/NEWS index d9fbe8eab4..e930b6808f 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,8 @@ PHP NEWS literal). (Ilia) - Fixed bug #47616 (curl keeps crashing). (Felipe) - Fixed bug #47598 (FILTER_VALIDATE_EMAIL is locale aware). (Ilia) +- Fixed bug #47564 (unpacking unsigned long 32bit bit endian returns wrong + result). (Ilia) - Fixed bug #47487 (performance degraded when reading large chunks after fix of bug #44607). (Arnaud) - Fixed bug #47468 (enable cli|cgi-only extensions for embed sapi). (Jani) diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 5fc472db0a..9dd4f47a48 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -799,6 +799,13 @@ PHP_FUNCTION(unpack) } v |= php_unpack(&input[inputpos], 4, issigned, map); + if (sizeof(long) > 4) { + if (type == 'l') { + v = (signed int) v; + } else { + v = (unsigned int) v; + } + } add_assoc_long(return_value, n, v); break; } diff --git a/ext/standard/tests/strings/bug38770.phpt b/ext/standard/tests/strings/bug38770.phpt index 2494a911bd..75522ee9d5 100644 --- a/ext/standard/tests/strings/bug38770.phpt +++ b/ext/standard/tests/strings/bug38770.phpt @@ -12,7 +12,7 @@ echo "Done\n"; --EXPECT-- Array ( - [1] => -30000 + [1] => 4294937296 ) Array (