php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41939 Bizarre behaviour testing a variable
Submitted: 2007-07-09 14:38 UTC Modified: 2007-07-09 14:58 UTC
From: steve at tequilasolutions dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.3 OS: FC4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: steve at tequilasolutions dot com
New email:
PHP Version: OS:

 

 [2007-07-09 14:38 UTC] steve at tequilasolutions dot com
Description:
------------
I have a variable set to 0.

if ($var=="on") returns true!!

This behaviour is not there in php4

Reproduce code:
---------------
admin@ds1009# php -v
PHP 4.3.11 (cgi) (built: Jun 16 2005 17:25:40)
Copyright (c) 1997-2004 The PHP Group

admin@ds1009# php
<?
        $val = 0;
        if ($val=="on") print "on\n";
?>
admin@ds1009# php5
<?
        $val = 0;
        if ($val=="on") print "on\n";
?>
on
admin@ds1009# php5
<?
        $var = 0;
        if ($var=='anything') print "anything";
?>
anythingadmin@ds1009#

This bug is also in PHP/5.0.4 and may have been there since then.



admin@ds1009#


Expected result:
----------------
0 should not equal 'on' or 'anything' 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-09 14:58 UTC] scottmac@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC