diff options
author | Remi Collet <remi@php.net> | 2012-12-11 16:30:08 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2012-12-11 16:30:08 +0100 |
commit | 4d8d5d83fce83c32a04cd8d8cf50d909ab101f38 (patch) | |
tree | 4e62956f55b58c5026187b339a48305b96ba105c /ext/standard/pack.c | |
parent | a9a5f7aca61d4bec9ce2cf5dc967bb7c0ed651cd (diff) | |
download | php-git-4d8d5d83fce83c32a04cd8d8cf50d909ab101f38.tar.gz |
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"
Diffstat (limited to 'ext/standard/pack.c')
-rw-r--r-- | ext/standard/pack.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 9894746f77..0472cb24a9 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; } |