ID:               9768
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: Any
 PHP Version:      4.0.4pl1
 New Comment:

and it would introduce a portability nightmare. not going to happen.


Previous Comments:
------------------------------------------------------------------------

[2001-03-15 11:55:57] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=9768&edit=1

Reply via email to