{
        register_shutdown_function(array($this, 'handleFatalError'));
        $this->handleFatalErrors = true;
        $this->originalDisplayErrors = ini_get('display_errors');
        ini_set('display_errors', !$this->suppression);
        $this->step();
    }
    protected function step()
    {
        if ($this->steps) {
            $step = array_shift($this->steps);
            if ($step['onErrorState'] === null || $step['onErrorState'] === $this->error) {
                try {
                    call_user_func($step['callback'], $this);
                } catch (Exception $ex) {
                    $this->lastException = $ex;
                    throw $ex;
                }
            }
            $this->step();
        } else {
            // Now clean up
            $this->handleFatalErrors = false;
            ini_set('display_errors', $this->originalDisplayErrors);
        }
    }
}
ErrorControlChain::$fatal_errors = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR;
if (defined('E_RECOVERABLE_ERROR')) {
    ErrorControlChain::$fatal_errors |= E_RECOVERABLE_ERROR;
}
示例#2
0
    if (php_sapi_name() === 'cli-server' && file_exists(BASE_PATH . $url) && is_file(BASE_PATH . $url)) {
        return false;
    }
}
// Remove base folders from the URL if webroot is hosted in a subfolder
if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) {
    $url = substr($url, strlen(BASE_URL));
}
/**
 * Include SilverStripe's core code
 */
require_once 'core/startup/ErrorControlChain.php';
require_once 'core/startup/ParameterConfirmationToken.php';
// Prepare tokens and execute chain
$reloadToken = ParameterConfirmationToken::prepare_tokens(array('isTest', 'isDev', 'flush'));
$chain = new ErrorControlChain();
$chain->then(function ($chain) use($reloadToken) {
    // If no redirection is necessary then we can disable error supression
    if (!$reloadToken) {
        $chain->setSuppression(false);
    }
    // Load in core
    require_once 'core/Core.php';
    // Connect to database
    require_once 'model/DB.php';
    global $databaseConfig;
    if ($databaseConfig) {
        DB::connect($databaseConfig);
    }
    // Check if a token is requesting a redirect
    if (!$reloadToken) {
 public function translateMemstring($memstring)
 {
     return parent::translateMemstring($memstring);
 }
示例#4
0
            $_REQUEST = array_merge((array) $_REQUEST, (array) $_GET);
        }
    } else {
        $url = $_SERVER["REQUEST_URI"];
    }
}
// Remove base folders from the URL if webroot is hosted in a subfolder
if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) {
    $url = substr($url, strlen(BASE_URL));
}
/**
 * Include SilverStripe's core code
 */
require_once 'core/startup/ErrorControlChain.php';
require_once 'core/startup/ParameterConfirmationToken.php';
$chain = new ErrorControlChain();
$token = new ParameterConfirmationToken('flush');
function silverstripe_main($chain)
{
    global $token;
    if (isset($_GET['flush']) && !$token->tokenProvided()) {
        unset($_GET['flush']);
    } else {
        $chain->setSuppression(false);
    }
    /**
     * Include Sapphire's core code
     */
    require_once "core/Core.php";
    if (function_exists('mb_http_output')) {
        mb_http_output('UTF-8');
示例#5
0
            }
        } else {
            $url = $_SERVER["REQUEST_URI"];
        }
    }
}
// Remove base folders from the URL if webroot is hosted in a subfolder
if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) {
    $url = substr($url, strlen(BASE_URL));
}
/**
 * Include SilverStripe's core code
 */
require_once 'core/startup/ErrorControlChain.php';
require_once 'core/startup/ParameterConfirmationToken.php';
$chain = new ErrorControlChain();
$token = new ParameterConfirmationToken('flush');
$chain->then(function ($chain) use($token) {
    // First, if $_GET['flush'] was set, but no valid token, suppress the flush
    if (isset($_GET['flush']) && !$token->tokenProvided()) {
        unset($_GET['flush']);
    } else {
        $chain->setSuppression(false);
    }
    // Load in core
    require_once 'core/Core.php';
    // Connect to database
    require_once 'model/DB.php';
    global $databaseConfig;
    if ($databaseConfig) {
        DB::connect($databaseConfig);