Req #39091 [Fbk->NoF]: Need to force variables to be declared

From: Date: Sun, 29 Jan 2017 04:22:48 +0000
Subject: Req #39091 [Fbk->NoF]: Need to force variables to be declared
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207024@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=39091&edit=1 ID: 39091 Updated by: php-bugs@lists.php.net Reported by: addw at phcomp dot co dot uk Summary: Need to force variables to be declared -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: *General Issues Operating System: any PHP Version: 5.2.0RC5 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2017-01-20 21:58:00] heiglandreas@php.net Is this still relevant? ------------------------------------------------------------------------ [2006-10-12 10:34:40] addw at phcomp dot co dot uk No, E_ALL does not do everything that I need. It will not report mistyped variables who are assigned, only those that are used. E_ALL only generates a warning when code is executed which is not useful for infrequently executed code. ------------------------------------------------------------------------ [2006-10-11 19:08:08] ceo at l-i-e dot com Turn error_reporting to E_ALL, and you have exactly what you asked for, and so much more. ------------------------------------------------------------------------ [2006-10-09 10:40:48] addw at phcomp dot co dot uk Description: ------------ Could we not use 'var' to declare variables outside of functions and have a config option or file related pragma that made not declaring a variable an error ? Yes: there would be a problem with existing code, so why not force variable declaration iff/after a 'var' declaration is seen. If you really want to do it properly, then we could use 'private' or 'static' to declare variables with the scope of the file that they are declared in (like in C). The most recent bug reference that I can find for this is: 14285 (Nov 2001). This is a MUST HAVE, it is the single most dangerous mis-feature of PHP. Don't get me wrong - I like PHP, but just hanker after perl's use strict - great at pointing out typeos. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=39091&edit=1

« previous php.bugs (#207024) next »