Edit report at https://bugs.php.net/bug.php?id=63738&edit=1

 ID:                 63738
 Updated by:         r...@php.net
 Reported by:        r...@php.net
 Summary:            unpack string behavior change
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   GNU/Linux (Fedora 17)
 PHP Version:        5.5Git-2012-12-11 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Sorry, haven't read carefully UPGRADING

 - pack()/unpack() had the following changes, which bring it more in line
  with Perl's behavior:
  - Implemented format character "Z": NUL-padded string
  - "a" now does not remove trailing NUL characters on unpack() anymore
  - "A" will now strip all trailing ASCII whitespace on unpack() (it used to
    remove only trailing spaces).


Previous Comments:
------------------------------------------------------------------------
[2012-12-11 13:51:09] r...@php.net

Description:
------------
Seems a regression between 5.4.9 and 5.5.0-dev

This breaks Archive_Tar


Test script:
---------------
<?php
$a="AB\x00\x00";
var_dump($a);
var_dump(unpack("a4foo", $a));


Expected result:
----------------
With php 5.4.9:

string(4) "AB^@^@"
array(1) {
  ["foo"]=>
  string(2) "AB"
}


Actual result:
--------------
With php 5.5.0-dev:

string(4) "AB^@^@"
array(1) {
  ["foo"]=>
  string(4) "AB^@^@"
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63738&edit=1

Reply via email to