From:             [EMAIL PROTECTED]
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



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to