php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9768 Support for negative_equals_false configuration variable
Submitted: 2001-03-15 11:55 UTC Modified: 2002-04-27 15:06 UTC
From: melvyn at idg dot nl Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: melvyn at idg dot nl
New email:
PHP Version: OS:

 

 [2001-03-15 11:55 UTC] melvyn at idg dot nl
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)];
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-27 15:06 UTC] jimw@php.net
and it would introduce a portability nightmare. not going to happen.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 19:01:32 2025 UTC