cvs: php4 /ext/standard string.c /ext/standard/tests/strings wordwrap.phpt
| From: | jim winstead | Date: | Mon, 18 Mar 2002 02:01:01 +0000 |
| Subject: | cvs: php4 /ext/standard string.c /ext/standard/tests/strings wordwrap.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10315@lists.php.net to get a copy of this message | ||
jimw Sun Mar 17 21:01:01 2002 EDT
Modified files:
/php4/ext/standard string.c
/php4/ext/standard/tests/strings wordwrap.phpt
Log:
Fix calculation of output buffer size in wordwrap(). (Thanks to Wez.)
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.264 php4/ext/standard/string.c:1.265
--- php4/ext/standard/string.c:1.264 Tue Mar 12 02:05:40 2002
+++ php4/ext/standard/string.c Sun Mar 17 21:00:53 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.264 2002/03/12 07:05:40 yohgaki Exp $ */
+/* $Id: string.c,v 1.265 2002/03/18 02:00:53 jimw Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -662,7 +662,7 @@
else {
/* Multiple character line break or forced cut */
if (linelength > 0) {
- newtextlen = textlen + (textlen/linelength) * breakcharlen + 1;
+ newtextlen = textlen + (textlen/linelength + 1) * breakcharlen + 1;
}
else {
newtextlen = textlen * (breakcharlen + 1) + 1;
Index: php4/ext/standard/tests/strings/wordwrap.phpt
diff -u php4/ext/standard/tests/strings/wordwrap.phpt:1.4
php4/ext/standard/tests/strings/wordwrap.phpt:1.5
--- php4/ext/standard/tests/strings/wordwrap.phpt:1.4 Tue Mar 5 04:00:56 2002
+++ php4/ext/standard/tests/strings/wordwrap.phpt Sun Mar 17 21:00:57 2002
@@ -27,6 +27,8 @@
"12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1)
+"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10,
"|==", 1)
+
TESTS;
include('tests/quicktester.inc');