Skip to content

Instantly share code, notes, and snippets.

@RafaelKa
Created June 19, 2013 14:58
Show Gist options
  • Save RafaelKa/5814987 to your computer and use it in GitHub Desktop.
Save RafaelKa/5814987 to your computer and use it in GitHub Desktop.
Flow shows something by fatal error.
<?php
/* *
* This script belongs to the TYPO3 Flow framework. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
function showFatalErrorMessage() {
$context = getenv('FLOW_CONTEXT');
$error = error_get_last();
if (empty($error) || (isset($error['type']) && $error['type'] !== E_ERROR)) {
return;
}
if ($context === 'Development') {
var_dump($error);
} elseif ($context === 'Production') {
}
}
register_shutdown_function('showFatalErrorMessage');
$rootPath = isset($_SERVER['FLOW_ROOTPATH']) ? $_SERVER['FLOW_ROOTPATH'] : FALSE;
if ($rootPath === FALSE && isset($_SERVER['REDIRECT_FLOW_ROOTPATH'])) {
$rootPath = $_SERVER['REDIRECT_FLOW_ROOTPATH'];
}
if ($rootPath === FALSE) {
$rootPath = dirname(__FILE__) . '/../';
} elseif (substr($rootPath, -1) !== '/') {
$rootPath .= '/';
}
require($rootPath . 'Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Bootstrap.php');
$context = getenv('FLOW_CONTEXT') ?: (getenv('REDIRECT_FLOW_CONTEXT') ?: 'Development');
$bootstrap = new \TYPO3\Flow\Core\Bootstrap($context);
$bootstrap->run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment