On Mon, 24 Dec 2012 12:13:35 -0000, Anthony Ferrara <ircmax...@gmail.com> wrote:

You're right. It does break BC, but this was a bug fix.
https://bugs.php.net/bug.php?id=61038

The behavior is incorrect in that regard.

However in this case that *bug* does have fairly significant BC
implications.

In fact, how I read the specification is that the original binary format is NULL padded, not the resulting string. Therefore, you could make the
argument that the new behavior is wrong.

The Perl docs say:

´A´ strips trailing whitespace and nulls, ´Z´ strips everything after the first null, and ´a´ returns data with no stripping at all.

PHP docs are silent on this matter.

Yes, PHP does not have to follow Perl's specification, but
1) PHP's pack/unpack was clearly modeled after Perl
2) is desirable to have close semantics to Perl's implementation as it benefits those who use both languages like the submitter of #61038

Given 1), perl's docs and implementation and the absence of evidence to the contrary (like PHP tests and documentation), it's clear to me that pre-5.5 behavior is a bug (no quotes).

Now you may think that the cost of fixing this bug does not cover its benefits, possibly given alternative solutions.

What I can say about that is that I think that the alternative solution that you propose (switching the behavior of "a" and "Z") would be trading a relatively minor short term inconvenience (this will affect several orders of magnitude less people than the htmlentities() change in 5.4) for one that will exist indefinitely and I consider that a poor choice.

--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to