FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

LinkBack Thread Tools
Old 02-17-2009, 12:46 PM
Allan Clements
Default php5: string comparison operators fail if string starts with 0x

Package: php5
Version: 5.2.6-2ubuntu4.1
Severity: important

The operators == and != appear to fail if the string being compared starts with 0x

Using an example:

$a = "0xF14067C1C600003D";
$b = $a; // $b is now equal to $a

if ($a == $b){ // $a should be equal to $b
echo "pass";
}else {
echo "fail";

Expected behaviour is that "pass" is printed.
However "fail" is printed in under 5.2.6 in ubuntu/debian.

The length of the string after the 0x also seems to matter (removing the latter half of the string will make it work correctly).

I have tested it on an older version of php under debian and with version 5.2.6 under windows and the example
above behaves correctly. It seems to be a problem specific to 5.2.6 under ubuntu/debian.

Using string comparison functions instead of the standard operators works as expected.

-- System Information:
Debian Release: lenny/sid
APT prefers intrepid-updates
APT policy: (500, 'intrepid-updates'), (500, 'intrepid-security'), (500, 'intrepid')
Architecture: i386 (i686)

Kernel: Linux 2.6.27-9-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages php5 depends on:
ii libapache2-mod-php5 5.2.6-2ubuntu4.1 server-side, HTML-embedded scripti
ii php5-cgi 5.2.6-2ubuntu4.1 server-side, HTML-embedded scripti
ii php5-common 5.2.6-2ubuntu4.1 Common files for packages built fr

php5 recommends no packages.

-- no debconf information

ubuntu-users mailing list
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Thread Tools

All times are GMT. The time now is 07:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org