diff --git a/appendices/migration55.xml b/appendices/migration55.xml
index 278deeeaef..d032d610ee 100644
--- a/appendices/migration55.xml
+++ b/appendices/migration55.xml
@@ -90,6 +90,70 @@
+
+ pack and unpack changes
+
+
+ Changes were made to pack and
+ unpack to make them more compatible with Perl:
+
+
+
+
+
+ pack now supports the "Z" format code, which
+ behaves identically to "a".
+
+
+
+
+ unpack now support the "Z" format code for NULL
+ padded strings, and behaves as "a" did in previous versions: it will
+ strip trailing NULL bytes.
+
+
+
+
+ unpack now keeps trailing NULL bytes when the "a"
+ format code is used.
+
+
+
+
+ unpack now strips all trailing ASCII whitespace
+ when the "A" format code is used.
+
+
+
+
+
+ Writing backward compatible code that uses the "a" format code with
+ unpack requires the use of
+ version_compare, due to the backward compatibility
+ break.
+
+
+ For example:
+
+
+
+=')) {
+ $data = unpack('Z5', $packed);
+} else {
+ $data = unpack('a5', $packed);
+}
+?>
+]]>
+
+
+
+
PHP logo GUIDs removed
@@ -418,20 +482,10 @@ String dereferencing: P
- pack and unpack now support the
- Z format character for null-padded strings.
-
-
-
-
- unpack's a format no longer
- strips trailing null bytes, bringing it into line with Perl's behaviour.
-
-
-
-
- unpack's A format now strips all
- trailing ASCII whitespace, bringing it into line with Perl's behaviour.
+ The behaviour of pack and
+ unpack with the "a" and "A" format codes has
+ changed.
+ Detailed notes on these changes are available.
diff --git a/reference/misc/functions/pack.xml b/reference/misc/functions/pack.xml
index 25768594bd..1c77783dfc 100644
--- a/reference/misc/functions/pack.xml
+++ b/reference/misc/functions/pack.xml
@@ -133,6 +133,10 @@
XBack up one byte
+
+ Z
+ NUL-padded string (new in PHP 5.5)
+ @NUL-fill to absolute position
@@ -161,6 +165,31 @@
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.5.0
+
+ The "Z" code was added with equivalent functionality to "a" for Perl
+ compatibility.
+
+
+
+
+
+
+
+
&reftitle.examples;
diff --git a/reference/misc/functions/unpack.xml b/reference/misc/functions/unpack.xml
index e55936fc2a..94b3c63a94 100644
--- a/reference/misc/functions/unpack.xml
+++ b/reference/misc/functions/unpack.xml
@@ -58,6 +58,43 @@
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.5.0
+
+
+ Changes were made to bring this function into line with Perl:
+
+
+ The "a" code now retains trailing NULL bytes.
+
+
+ The "A" code now strips all trailing ASCII whitespace (spaces, tabs,
+ newlines, carriage returns, and NULL bytes).
+
+
+ The "Z" code was added for NULL-padded strings, and removes trailing
+ NULL bytes.
+
+
+
+
+
+
+
+
+
&reftitle.examples;