|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15407 The " == " op does not work
Submitted: 2002-02-06 16:00 UTC Modified: 2002-02-06 16:57 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: piapoco at excite dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
38 + 30 = ?
Subscribe to this entry?

 [2002-02-06 16:00 UTC] piapoco at excite dot com
I'm using Apache and IIS 5.

When I use the comparison operator ( == ), my code fails. But when I use a single ( = ), it goes fine. I'm using the plain config that comes with Apache and PHP, but added a line to have .incs treated in the server.

This is the lame code:

if ($myrow == mysql_fetch_array($Recset))
  $gIDClient = $HTTP_POST_VARS["IDClient"];

The assigment never gets touched and no error messages are issued. 
Weird, ain't it?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 16:08 UTC]
= is no comparison operator but an assignment operator. since a $var = "bla" is not very error prone of course it "works" but that is logically not what you want. additionally the == operator on arrays is not veryhelpful. I suggest, you read the manual sections about "Assignments", "Comparision", "Arrays" and "Array Functions". No bug -> bogus 
 [2002-02-06 16:57 UTC]
>'since a $var = "bla" is not very error prone of course it "works"'

"of course" is not right. the assignment will be done and the value of the expression will be used to determine whether the if() will be true or not. If mysql_fetch_array() would return false or null, the "of course" is not true anymore
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 08:01:27 2024 UTC