com php-src: Apparently negative wordwrap is a thing and should work as length = 0.: ext/standard/string.c
| From: | Ferenc Kovacs | Date: | Wed, 12 Oct 2016 23:53:56 +0000 |
| Subject: | com php-src: Apparently negative wordwrap is a thing and should work as length = 0.: ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94998@lists.php.net to get a copy of this message | ||
Commit: 06721070a49e3e1073d2d4066a416ecf2e97baf0
Author: Stanislav Malyshev <stas@php.net> Mon, 3 Oct 2016 19:17:42 -0700
Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 13 Oct 2016 01:53:56 +0200
Parents: 28ed09929c8b0d76f1c0c3ecc82d4356231d556c
Branches: PHP-5.6.27
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=06721070a49e3e1073d2d4066a416ecf2e97baf0
Log:
Apparently negative wordwrap is a thing and should work as length = 0.
I'll leave it as is for now.
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index cb6a8b4..abe4eb1 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -908,7 +908,11 @@ PHP_FUNCTION(wordwrap)
RETURN_FALSE;
}
- if (linelength < 0 || linelength > INT_MAX) {
+ if (linelength < 0) {
+ /* For BC */
+ linelength = 0;
+ }
+ if (linelength > INT_MAX) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be between 0 and %d",
INT_MAX);
RETURN_FALSE;
}