#20005 [NEW]: trim does not trim a string in array
| From: | chris at xwave dot ch | Date: | Mon, 21 Oct 2002 09:04:36 +0000 |
| Subject: | #20005 [NEW]: trim does not trim a string in array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-22944@lists.php.net to get a copy of this message | ||
From: chris@xwave.ch
Operating system: Linux suse 2.4.16-4GB
PHP version: 4.2.3
PHP Bug Type: Strings related
Bug description: trim does not trim a string in array
I've got this code segement:
--- snip ---
$buffer = fgets($if);
$e = split("\t", trim($buffer));
for ($ic = 0 ; $ic > count($e); $ic++) {
$e[$ic] = trim($e[$ic]);
}
--- snap ---
The string in the array $e[] is never trimmed. In it does just the same as
$e[$ic] = $e[$ic];
Same behaviour in chop!
When I changed the code to this:
--- snip ---
$buffer = fgets($if);
$b = trim($buffer);
$e = split("\t", $b);
for ($ic = 0 ; $ic < count($e); $ic++) {
$t[$ic] = trim($e[$ic]);
}
--- snap ---
it works as expected.
Chris
--
Edit bug report at http://bugs.php.net/?id=20005&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20005&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20005&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20005&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20005&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20005&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20005&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20005&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20005&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20005&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20005&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20005&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20005&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20005&r=isapi