Bug #16568 Updated: string comparison features give opposing results
| From: | sander@php.net | Date: | Fri, 12 Apr 2002 15:32:02 +0000 |
| Subject: | Bug #16568 Updated: string comparison features give opposing results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-4750@lists.php.net to get a copy of this message | ||
ID: 16568
Updated by: sander@php.net
Reported By: lent@fstrf.org
Status: Bogus
Bug Type: Strings related
Operating System: SunOS 5.6
PHP Version: 4.1.2
New Comment:
$myrow[6] is not an empty string because you're trim()'ing the string
incorrectly. See http://www.php.net/manual/en/function.trim.php
Previous Comments:
------------------------------------------------------------------------
[2002-04-12 11:16:20] lent@fstrf.org
I'm not asking a support question.
$myrow[6] is an empty string.
ord($myrow[6]) returns 32 (ascii for ' ')
the first character of an empty string shouldn't evaluate as ascii 32.
So this is a bug.
------------------------------------------------------------------------
[2002-04-12 11:11:49] sniper@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
------------------------------------------------------------------------
[2002-04-12 10:46:52] lent@fstrf.org
NOTE: in the examples below the $myrow array is a string array
populated by an ingres select statement.
if $myrow[6] is null going into the first example then
$myrow[6] will not be set to &npsp, but in the second example it will.
Shouldn't these two examples be equivalent? Also strcmp function
behaves like example 1.
EXAMPLE 1:
trim($myrow[6]);
($myrow[6]) == " " ? $myrow[6] = " ")
EXAMPLE 2:
trim($myrow[6]);
(ord($myrow[6]) == 32 ? $myrow[6] = " ");
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16568&edit=1