Re: wordwrap with negative width
| From: | Lauri Kenttä | Date: | Sat, 15 Oct 2016 11:34:33 +0000 |
| Subject: | Re: wordwrap with negative width | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96379@lists.php.net to get a copy of this message | ||
On 2016-10-13 22:39, Yasuo Ohgaki wrote:
Hi Stas, Niklas, On Thu, Oct 13, 2016 at 2:13 PM, Stanislav Malyshev <smalyshev@gmail.com> wrote:Keeping the current behavior doesn't really cost anything. Why change it? It's very easy to imagine a script like this: <?php $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. -- Lauri KenttäI agree Stas. If we consider compatibility, keeping nonsense behavior is better. However, who sets negative offset and make use of it? Compatibility is important, but this current behavior is not important, IMO.Sorry for the late reply. Why not keep the current behavior + warning?Because current behavior makes no sense, negative length is not really something that exists.