This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151396

Summary: Accidental Assignment Warning
Product: php Reporter: compucoder <compucoder>
Component: EditorAssignee: Tomasz Slota <tslota>
Status: VERIFIED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description compucoder 2008-10-26 14:52:48 UTC
I think you need to enhance the rules that determine if this is a warning or not. The concept is great and will save
people a lot of debugging headaches but I think it can be made more intelligent. For example if you have this code:

if(!$result = $db->query($query))
   throw new DBQueryFailure("DB Query failed in method [".__FUNCTION__."] in class [".__CLASS__."]\n", $db->errno,
$db->error);

    return true;
  }

I can see this throwing a warning because there is no way of distinguising they know what they were doing, but if you
have this:

  	if(!($result = $db->query($query)))
  		throw new DBQueryFailure("DB Query failed in method [".__FUNCTION__."] in class [".__CLASS__."]\n", $db->errno,
$db->error);

    return true;
  }

You can see they know what they are doing, they have the assignment enclosed in brackets. I think you should add in a
check to your accidental assignment code to test if they do have brackets around the assignment. if so then the warning
should be removed. You should do this for all copnstructs that can do tests like if, while, do while, for, foreach.

I believe Zend Studio has tests in place to do exactly what I state above and remove their warning.

Thanks.
Comment 1 Tomasz Slota 2008-10-27 15:32:26 UTC

*** This issue has been marked as a duplicate of 147259 ***
Comment 2 Mikhail Matveev 2008-10-27 15:44:39 UTC
Verified duplicate