PHP 4.0 Bug #9768: Support for negative_equals_false configuration variable

From: Date: Thu, 15 Mar 2001 16:55:57 +0000
Subject: PHP 4.0 Bug #9768: Support for negative_equals_false configuration variable
Groups: php.dev 
Request: Send a blank email to php-dev+get-49001@lists.php.net to get a copy of this message
From: melvyn@idg.nl Operating system: Any PHP version: 4.0.4pl1 PHP Bug Type: Feature/Change Request Bug description: Support for negative_equals_false configuration variable Hi, I'd like to see support for a configuration variable which enables developers, to set a negative value (ie - a negative numeric value, not a string starting with a - sign or an intval("-5abc")) to resolve to FALSE. This would make error_handling using constants so much easier. Example: <? define(FILE_NOT_IN_INC=-1); define(INVALID_FILE_REQUEST=-2); $errors=array( 'unknown error', 'Invalid installation. Please contact your administrator. File not in designated include dir', 'Invalid installation. Please contact your administrator. Filename is invalid'); class definition { ... function do_includes() { //______Centralize security checks in the main configuration object $functions_file=$this->appname.'.functions.php'; if(file_exists($this->inc_dir.'/'.$functions_file)) { if(!ereg("^(\.|/)", $functions_file)) { //___assume $this->inc_dir is in php_include_path, but eliminate security threat, that '.' is prefered over $this->inc_dir. include $functions_file; } else { return INVALID_FILE_REQUEST; } } else { return FILE_NOT_IN_INC; } } } $instance=new definition; $ok=$instance->do_includes(); if(!$ok) { mail($instance->admin, "Installation problem your_app", "$SCRIPT_NAME - __LINE__ - $ok"); die($errors[abs($ok)]; } ?> -- Edit Bug report at: http://bugs.php.net/?id=9768&edit=1

« previous php.dev (#49001) next »