Bug #18214 Updated: Request: Warning on assignment in IF expression.

From: Date: Tue, 09 Jul 2002 06:09:54 +0000
Subject: Bug #18214 Updated: Request: Warning on assignment in IF expression.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13569@lists.php.net to get a copy of this message
ID: 18214 Updated by: philip@php.net -Summary: REQUEST: WARNING ON ASSIGNMENT IN IF EXPRESSION Reported By: djanix@hotmail.com -Status: Bogus +Status: Feedback Bug Type: Feature/Change Request Operating System: any PHP Version: 4CVS-2002-07-07 New Comment: What are some other potential "strict" mode watches? Some people ask for an optional "strict" mode with various options, this could be a good start? Imagine a strict mode directive where when on, various options could be set at runtime, like assignment_inside_expression = true :) Previous Comments: ------------------------------------------------------------------------ [2002-07-08 10:19:16] m.ford@lmu.ac.uk Rare??? What do you mean, rare??? Nearly every script I write uses this construct multiple times. Sometimes, it occurs more often than equality comparisons. Changing this would make my life hell!! Cheers! Mike ------------------------------------------------------------------------ [2002-07-07 18:18:31] jan@php.net on a side note, it is a good practice to swap the 'assignment arguments': if ('foo' == $bar), since 'foo' = $bar does produce a warning. ------------------------------------------------------------------------ [2002-07-07 17:55:54] djanix@hotmail.com right it's legal - but it's so rare that it is usually a mistake, which is why most c compilers will generate a warning for it. would have saved me a good 30 minutes tonight spent searching for the cause of a bug... :( -benjamin ------------------------------------------------------------------------ [2002-07-07 17:41:10] sniper@php.net Not possible: if ($xx = some_function()) {} is perfectly legal. ------------------------------------------------------------------------ [2002-07-07 17:40:16] sniper@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/18214 -- Edit this bug report at http://bugs.php.net/?id=18214&edit=1

« previous php.bugs (#13569) next »