Bug #18214 Updated: Request: strict mode option in PHP

From: Date: Tue, 09 Jul 2002 11:00:25 +0000
Subject: Bug #18214 Updated: Request: strict mode option in PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13588@lists.php.net to get a copy of this message
ID: 18214 Updated by: sniper@php.net Reported By: djanix@hotmail.com -Status: Feedback +Status: Won't fix Bug Type: Feature/Change Request Operating System: any PHP Version: 4CVS-2002-07-07 Previous Comments: ------------------------------------------------------------------------ [2002-07-09 06:21:58] hholzgra@php.net sidenote: c compilers that warn on if ( a = b ) usualy accept if ( ( a = b ) ) so only top level assignments are considert harmfull ------------------------------------------------------------------------ [2002-07-09 06:04:23] philip@php.net Nobody is wanting this to be a core feature (I would think not even error_reporting(E_ALL) would turn on strict mode) but rather part of an optional strict mode directive in PHP. AFAICT, most php-dev people are against a strict mode option altogether, and this feature request is only part of that. I, along with you and many others, love to do assignments in expressions. The minority wanting a mode similar to perls "use strict" or VBscripts "option explicit" or a C compiler or whatever, want optional options like this one. These people would/should understand what their getting into by enabling strict mode. BTW, I did not mean assignment_inside_expression to be a directive in php.ini but rather an option for, let's say, set_strict_mode_options(). I've searched archives and couldn't find the arguments against having this mode available but obviously some exist. Like, how PHP is simply not a strict language so deal with it. Or how adding an optional directive like this will confuse some people and cause headaches. Or how difficult and resource intensive such a change might be. *shrug* This may need to be a faq. Changing topic to be more generic. Related requests: #14285, #14405. ------------------------------------------------------------------------ [2002-07-09 04:58:58] tal@php.net IMHO, this behavior shhould not be implemented. This construct is used widely actually (almost in every script i've ever written). And usually warnings imply that something is wrong, while there is nothing wrong with that. -Tal ------------------------------------------------------------------------ [2002-07-09 02:09:53] philip@php.net 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 :) ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ 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 (#13588) next »