#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 User updated by: bugs dot php dot net at jonatan dot com Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: Again, please try reading before responding. You've still failed to answers to my questions. See specifically my comment from 20 Jun 2:39pm UTC. Thank you. Previous Comments: [2006-06-21 08:25:55] [EMAIL PROTECTED] $foo = 'Some tex Some tex Some text Some tex Some text Some tex'; $foo = '1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678'; If you fail to understand this, I don't think I can help you, sorry. [2006-06-21 08:15:57] bugs dot php dot net at jonatan dot com I only reopen the bug because your responses keep failing to address my comments. As with the majority of your previous comments, your last comment implies to me that you either haven't read, have misunderstood or have understood but choose not to respond to my latest comment. You think counting characters that don't exist is logical? And you will not consider adding the note to the documentation? I will only reopen this bug if you fail to answer these questions. [2006-06-21 07:39:53] [EMAIL PROTECTED] There is nothing to discuss. bjori and me already explained you every bit of your code. Please STOP reopening this BOGUS report. Thank you. [2006-06-20 21:47:02] bugs dot php dot net at jonatan dot com Unbogusing again, as per my previous comment. (As for needing to explain to me how to count from 1 to 9, apparently you do. I was under the assumption that one should always start at 1...) [2006-06-20 14:39:10] bugs dot php dot net at jonatan dot com Sorry for my tone earlier. It didn't seem like anyone understood my bug report. It is only the tenth character if you count the leading space, which doesn't exist, because it has been trimmed. Your explanation would make sense if wordwrap() didn't trim leading (or trailing) spaces from wrapped lines; resulting in something like: Some tex Some tex Some text Some tex Some text Some tex (note leading and trailing space on lines) But that's not what wordwrap() returns. The fact that (I'm guessing) the trimming internally occurs after the counting is merely an implementation detail of wordwrap() that shouldn't be exposed outside the function. I'd suggest fixing wordwrap() to wrap more efficiently. Given the trimming of spaces, that can hardly be considered to be incorrect. Either that, or adding the following note to the documentation: Note that if a line happens to be exactly as long as the maximum line length, the following line will be considered to start with a leading space, even though it does not do so, for porposes of calculating the maximum amount of text that can fit on that line. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37846 -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 Updated by: [EMAIL PROTECTED] Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: $foo = 'Some tex Some tex Some text Some tex Some text Some tex'; $foo = '1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678'; If you fail to understand this, I don't think I can help you, sorry. Previous Comments: [2006-06-21 08:15:57] bugs dot php dot net at jonatan dot com I only reopen the bug because your responses keep failing to address my comments. As with the majority of your previous comments, your last comment implies to me that you either haven't read, have misunderstood or have understood but choose not to respond to my latest comment. You think counting characters that don't exist is logical? And you will not consider adding the note to the documentation? I will only reopen this bug if you fail to answer these questions. [2006-06-21 07:39:53] [EMAIL PROTECTED] There is nothing to discuss. bjori and me already explained you every bit of your code. Please STOP reopening this BOGUS report. Thank you. [2006-06-20 21:47:02] bugs dot php dot net at jonatan dot com Unbogusing again, as per my previous comment. (As for needing to explain to me how to count from 1 to 9, apparently you do. I was under the assumption that one should always start at 1...) [2006-06-20 14:39:10] bugs dot php dot net at jonatan dot com Sorry for my tone earlier. It didn't seem like anyone understood my bug report. It is only the tenth character if you count the leading space, which doesn't exist, because it has been trimmed. Your explanation would make sense if wordwrap() didn't trim leading (or trailing) spaces from wrapped lines; resulting in something like: Some tex Some tex Some text Some tex Some text Some tex (note leading and trailing space on lines) But that's not what wordwrap() returns. The fact that (I'm guessing) the trimming internally occurs after the counting is merely an implementation detail of wordwrap() that shouldn't be exposed outside the function. I'd suggest fixing wordwrap() to wrap more efficiently. Given the trimming of spaces, that can hardly be considered to be incorrect. Either that, or adding the following note to the documentation: Note that if a line happens to be exactly as long as the maximum line length, the following line will be considered to start with a leading space, even though it does not do so, for porposes of calculating the maximum amount of text that can fit on that line. [2006-06-20 14:00:58] [EMAIL PROTECTED] 1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678 The latter "t" in "text" is the TENTH character. Now PLEASE leave this report as bogus. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37846 -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 User updated by: bugs dot php dot net at jonatan dot com Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: I only reopen the bug because your responses keep failing to address my comments. As with the majority of your previous comments, your last comment implies to me that you either haven't read, have misunderstood or have understood but choose not to respond to my latest comment. You think counting characters that don't exist is logical? And you will not consider adding the note to the documentation? I will only reopen this bug if you fail to answer these questions. Previous Comments: [2006-06-21 07:39:53] [EMAIL PROTECTED] There is nothing to discuss. bjori and me already explained you every bit of your code. Please STOP reopening this BOGUS report. Thank you. [2006-06-20 21:47:02] bugs dot php dot net at jonatan dot com Unbogusing again, as per my previous comment. (As for needing to explain to me how to count from 1 to 9, apparently you do. I was under the assumption that one should always start at 1...) [2006-06-20 14:39:10] bugs dot php dot net at jonatan dot com Sorry for my tone earlier. It didn't seem like anyone understood my bug report. It is only the tenth character if you count the leading space, which doesn't exist, because it has been trimmed. Your explanation would make sense if wordwrap() didn't trim leading (or trailing) spaces from wrapped lines; resulting in something like: Some tex Some tex Some text Some tex Some text Some tex (note leading and trailing space on lines) But that's not what wordwrap() returns. The fact that (I'm guessing) the trimming internally occurs after the counting is merely an implementation detail of wordwrap() that shouldn't be exposed outside the function. I'd suggest fixing wordwrap() to wrap more efficiently. Given the trimming of spaces, that can hardly be considered to be incorrect. Either that, or adding the following note to the documentation: Note that if a line happens to be exactly as long as the maximum line length, the following line will be considered to start with a leading space, even though it does not do so, for porposes of calculating the maximum amount of text that can fit on that line. [2006-06-20 14:00:58] [EMAIL PROTECTED] 1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678 The latter "t" in "text" is the TENTH character. Now PLEASE leave this report as bogus. [2006-06-20 14:00:30] [EMAIL PROTECTED] Oh, god.. Here is what wordwrap() does: "Some tex|Some tex|Some text| Some tex| Some tex|t Some tex" Write it down on paper and count symbols yourself. Is everything clear for you this time? Or do I need to explain how to count from 1 to 9? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37846 -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 User updated by: bugs dot php dot net at jonatan dot com Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: Sorry for my tone earlier. It didn't seem like anyone understood my bug report. It is only the tenth character if you count the leading space, which doesn't exist, because it has been trimmed. Your explanation would make sense if wordwrap() didn't trim leading (or trailing) spaces from wrapped lines; resulting in something like: Some tex Some tex Some text Some tex Some text Some tex (note leading and trailing space on lines) But that's not what wordwrap() returns. The fact that (I'm guessing) the trimming internally occurs after the counting is merely an implementation detail of wordwrap() that shouldn't be exposed outside the function. I'd suggest fixing wordwrap() to wrap more efficiently. Given the trimming of spaces, that can hardly be considered to be incorrect. Either that, or adding the following note to the documentation: Note that if a line happens to be exactly as long as the maximum line length, the following line will be considered to start with a leading space, even though it does not do so, for porposes of calculating the maximum amount of text that can fit on that line. Previous Comments: [2006-06-20 14:00:58] [EMAIL PROTECTED] 1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678 The latter "t" in "text" is the TENTH character. Now PLEASE leave this report as bogus. [2006-06-20 14:00:30] [EMAIL PROTECTED] Oh, god.. Here is what wordwrap() does: "Some tex|Some tex|Some text| Some tex| Some tex|t Some tex" Write it down on paper and count symbols yourself. Is everything clear for you this time? Or do I need to explain how to count from 1 to 9? [2006-06-20 13:57:01] bugs dot php dot net at jonatan dot com (Unfortunately the bug tracking system reformatted the code in my last comment, adding a line break in the statement that sets the $input variable, which was not intended to be there. There is supposed to be a space (and only a space) between each word in the string. So you'll need to change that if copying-and-pasting. Or just use my first reproduction example.) [2006-06-20 13:40:55] bugs dot php dot net at jonatan dot com Jesus H. Christ, will you please try to actually read the bug report before closing it as bogus. Again: I URGE you to look at the expected result and the actual result and consider why wordwrap() thinks "Some text" fits on one line while "Some text" doesn't, given that they both start at the beginning of a line. If you find the reproduction code formatting confusing, try reformatting it as such: '.wordwrap( $input, 9 )."\n"; ?> [2006-06-20 13:22:17] [EMAIL PROTECTED] . The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37846 -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 Updated by: [EMAIL PROTECTED] Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: 1234 678 1234 678 1234 6789 2345 789 2345 7890 2345 678 The latter "t" in "text" is the TENTH character. Now PLEASE leave this report as bogus. Previous Comments: [2006-06-20 14:00:30] [EMAIL PROTECTED] Oh, god.. Here is what wordwrap() does: "Some tex|Some tex|Some text| Some tex| Some tex|t Some tex" Write it down on paper and count symbols yourself. Is everything clear for you this time? Or do I need to explain how to count from 1 to 9? [2006-06-20 13:57:01] bugs dot php dot net at jonatan dot com (Unfortunately the bug tracking system reformatted the code in my last comment, adding a line break in the statement that sets the $input variable, which was not intended to be there. There is supposed to be a space (and only a space) between each word in the string. So you'll need to change that if copying-and-pasting. Or just use my first reproduction example.) [2006-06-20 13:40:55] bugs dot php dot net at jonatan dot com Jesus H. Christ, will you please try to actually read the bug report before closing it as bogus. Again: I URGE you to look at the expected result and the actual result and consider why wordwrap() thinks "Some text" fits on one line while "Some text" doesn't, given that they both start at the beginning of a line. If you find the reproduction code formatting confusing, try reformatting it as such: '.wordwrap( $input, 9 )."\n"; ?> [2006-06-20 13:22:17] [EMAIL PROTECTED] . [2006-06-20 13:17:00] bugs dot php dot net at jonatan dot com Wow, I don't know how it's possible to misunderstand such a simple bug report so extensively. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37846 -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 Updated by: [EMAIL PROTECTED] Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: "wordwrap() - Returns a string with str wrapped AT the column number specified by the optional width parameter." "Some text" <- the last "t" is symbol #9, so whole "text" word is wrapped (since you didn't pass third argument). Previous Comments: [2006-06-19 15:14:13] bugs dot php dot net at jonatan dot com No, I think you're the only one who is confused. ;-) I'm pretty sure this is a bug. The problem is that PHP only cuts some of the lines (the third in my example) at position 9, and incorrectly cuts some lines (the fifth in my example) at position 8. [2006-06-19 13:33:00] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You may be confused with your "virtual" lines (as I was as well :). worwrap does wrap at the pos. 9 and this is what it does. Word are not cuted. [2006-06-19 13:09:57] [EMAIL PROTECTED] reproducible in dev branches (5.2 and head), on other OS/platform than OSX as well. [2006-06-19 10:55:33] bugs dot php dot net at jonatan dot com Description: wordwrap() wraps incorrectly, wrapping too early in some situations. As the example below shows, PHP wraps one of the long lines ("Some text") at the maximum line length (9 characters in this case) and wraps the other one at a shorter line length. Removing the first line from the test case results in different but equally buggy wrapping. I'm using Marc Liyanage's build of PHP, version 5.1.4 on an Intel Mac. Reproduce code: --- '.wordwrap( $input, 9 )."\n"; ?> Expected result: Some tex Some tex Some text Some tex Some text Some tex Actual result: -- Some tex Some tex Some text Some tex Some text Some tex -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 User updated by: bugs dot php dot net at jonatan dot com Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: You seem to be just as confused as the other guy. ;-) Sure, I guess the slight vagueness of the documentation could allow you to argue that wordwrap() wraps the third line incorrectly and the fifth one correctly instead of the other way around. But that doesn't negate the fact that this is a bug, it would just make it a much bigger bug, affecting the majority of lines wrapped by wordwrap() instead of the minority. Also note that your claim is refuted by the examples in the documentation, specifically the line "jumped over the lazy" which is 20 characters long. I urge you to look at the expected result and the actual result and consider why wordwrap() thinks "Some text" fits on one line while "Some text" doesn't, given that they both start at the beginning of a line. Previous Comments: [2006-06-19 15:57:50] [EMAIL PROTECTED] "wordwrap() - Returns a string with str wrapped AT the column number specified by the optional width parameter." "Some text" <- the last "t" is symbol #9, so whole "text" word is wrapped (since you didn't pass third argument). [2006-06-19 15:14:13] bugs dot php dot net at jonatan dot com No, I think you're the only one who is confused. ;-) I'm pretty sure this is a bug. The problem is that PHP only cuts some of the lines (the third in my example) at position 9, and incorrectly cuts some lines (the fifth in my example) at position 8. [2006-06-19 13:33:00] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You may be confused with your "virtual" lines (as I was as well :). worwrap does wrap at the pos. 9 and this is what it does. Word are not cuted. [2006-06-19 13:09:57] [EMAIL PROTECTED] reproducible in dev branches (5.2 and head), on other OS/platform than OSX as well. [2006-06-19 10:55:33] bugs dot php dot net at jonatan dot com Description: wordwrap() wraps incorrectly, wrapping too early in some situations. As the example below shows, PHP wraps one of the long lines ("Some text") at the maximum line length (9 characters in this case) and wraps the other one at a shorter line length. Removing the first line from the test case results in different but equally buggy wrapping. I'm using Marc Liyanage's build of PHP, version 5.1.4 on an Intel Mac. Reproduce code: --- '.wordwrap( $input, 9 )."\n"; ?> Expected result: Some tex Some tex Some text Some tex Some text Some tex Actual result: -- Some tex Some tex Some text Some tex Some text Some tex -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1
#37846 [Bgs]: wordwrap() wraps incorrectly
ID: 37846 User updated by: bugs dot php dot net at jonatan dot com Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment: No, I think you're the only one who is confused. ;-) I'm pretty sure this is a bug. The problem is that PHP only cuts some of the lines (the third in my example) at position 9, and incorrectly cuts some lines (the fifth in my example) at position 8. Previous Comments: [2006-06-19 13:33:00] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You may be confused with your "virtual" lines (as I was as well :). worwrap does wrap at the pos. 9 and this is what it does. Word are not cuted. [2006-06-19 13:09:57] [EMAIL PROTECTED] reproducible in dev branches (5.2 and head), on other OS/platform than OSX as well. [2006-06-19 10:55:33] bugs dot php dot net at jonatan dot com Description: wordwrap() wraps incorrectly, wrapping too early in some situations. As the example below shows, PHP wraps one of the long lines ("Some text") at the maximum line length (9 characters in this case) and wraps the other one at a shorter line length. Removing the first line from the test case results in different but equally buggy wrapping. I'm using Marc Liyanage's build of PHP, version 5.1.4 on an Intel Mac. Reproduce code: --- '.wordwrap( $input, 9 )."\n"; ?> Expected result: Some tex Some tex Some text Some tex Some text Some tex Actual result: -- Some tex Some tex Some text Some tex Some text Some tex -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1