On 2016-10-16 03:28, Stanislav Malyshev wrote:
Keeping the current behavior doesn't really cost anything.
Why change it?
I think I answered this question several times, including in the email
you are quoting! If you disagree, please state the matter of your
disagreement, repeating the same question over and over does not help.
To be clear: I'm not agains the warning, I'm against the false.
I don't seem to find any other "answer" than your personal opinion that
the old behavior "doesn't make sense". That's not a real answer.
Zero width doesn't make sense either, so are you going to remove that as
There are a lot of things in PHP that don't make sense, and you can't
remove them all.
I'll rephrase the question: Suppose you add the warning anyway. What do
you gain by returning false? Is there an additional benefit?
It's very easy to imagine a script like this:
$text_width = $parent_width - $other_width - $margin;
echo wordwrap($text, $text_width);
Here someone tries to calculate $max_width dynamically.
The calculation might produce a negative result sometimes.
The text would be visible, even if it's not word wrapped.
It might not look as expected, but it would be readable.
If it was expected to be wrapped but is not, then it would be shown on
top of other elements, or break the design layout. Not exactly the best
idea. Since calling it with negative argument makes no sense, there's
behavior that makes sense. Producing an error means this nonsense
situation is discovered.
If it was seriously breaking their layout, they would fix it anyway.
Or they would say, "oh well, at least the text is readable!"
So let's suppose it currently works "well enough".
You get your patch in, and suddenly some text magically disappears.
They might not see the warning (old scripts often disable warnings),
so they might not know at all why the text is gone. They just tried
to upgrade PHP (or their sevice provider did), and now it's broken.
OTOH, if you only add the warning, some people may even fix their
code, others might not, and it doesn't really matter.
Also, if/when you document that negative width is no longer supported,
soon people will discover the easy fix, max($width,0), and you have
really gained nothing but more hacks in bad code.
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php