#31301 [Bgs->Opn]: trim() does not trim single whitespace variables

From: Date: Sun, 26 Dec 2004 17:34:39 +0000
Subject: #31301 [Bgs->Opn]: trim() does not trim single whitespace variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71087@lists.php.net to get a copy of this message
 ID:               31301
 User updated by:  aitrus at tresgeek dot net
 Reported By:      aitrus at tresgeek dot net
-Status:           Bogus
+Status:           Open
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      4.3.10
 New Comment:

I apologize, my example was too simple and did not reproduce the
problem:

$foo = " ";

$foo = html_entity_decode( $foo, ENT_QUOTES );
$foo = trim( $foo );

echo "x{$foo}x";

output is:  'x x'


Previous Comments:
------------------------------------------------------------------------

[2004-12-26 11:34:12] derick@php.net

Works fine here:
derick@kossu:~$ cat bug31301.php
<?php
$foo = " ";

$foo = trim( $foo );

echo "x{$foo}x";
?>

derick@kossu:~$ php-4.3dev bug31301.php
xx

------------------------------------------------------------------------

[2004-12-26 07:44:34] aitrus at tresgeek dot net

updated OS

------------------------------------------------------------------------

[2004-12-26 07:36:57] aitrus at tresgeek dot net

Description:
------------
When passed a string variable with a single space as its contents,
trim() returns a variable with a single space as its contents.

Reproduce code:
---------------
$foo = " ";

$foo = trim( $foo );

echo "x{$foo}x";

--

output is: 'x x'

Expected result:
----------------
trim() should return a empty string (or false).



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31301&edit=1


Thread (6 messages)

« previous php.bugs (#71087) next »