#23168 [Com]: Variables can be instantiated by first use

From: Date: Fri, 11 Apr 2003 15:19:17 +0000
Subject: #23168 [Com]: Variables can be instantiated by first use
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37569@lists.php.net to get a copy of this message
ID: 23168 Comment by: michael dot mauch at gmx dot de Reported By: sascha dot wildgrube at steganos dot com Status: Open Bug Type: Feature/Change Request Operating System: any PHP Version: 4.3.1 New Comment: Put something like this: function myErrorHandler ($errno, $errstr, $errfile, $errline) { die("<p>$errstr in line $errline of $errfile. Dieing now.</p>"); } error_reporting(E_ALL); set_error_handler(myErrorHandler); in an include file, and perhaps use the auto_prepend_file php.ini setting to automagically include it in all your scripts. Previous Comments: ------------------------------------------------------------------------ [2003-04-11 09:37:38] sascha dot wildgrube at steganos dot com This is not really a bug. It is a behaviour by design that has troubled php developers for years: The variable-can-be-instantiated-by-first-use-Effect! Just look at that: for ($nIndex=0; $nIndex < 23; $nIndx++) { whatever(); } Most compilers will produce an error like "what the hell is nIndx? Not php. php will produce an endless loop. That is weak! And it is still the number one time eater when programming php. Change that and php as a tool can virtually DOUBLE efficiency! Make the need of variable initialization an option so that the community is not pissed off and existing sources are not rendered useless but for god's sake add it for future use. PLEASE, PLEASE, PLEASE WITH SUGAR, PLEASE WITH SUGAR AND CREAM!!!! Thanks! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23168&edit=1

« previous php.bugs (#37569) next »