1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Ensure syntax errors and other configuration problems are surfaced to the user.

Summary:
Some PHP has junky defaults for error_reporting / display_errors, and the "@"
silences fatals. The @ should never have been there, I just copied it from the
libphutil initializer where we use @ because the default error message can be
confusing and we display a more useful one.

Test Plan:
Added fatals to my conf file, got a decent error message instead of silent exit
with err=255.

Reviewed By: aran
Reviewers: tuomaspelkonen, aran, jungejason
CC: aran
Differential Revision: 355
This commit is contained in:
epriestley 2011-05-27 16:39:34 -07:00
parent cc5a86f75a
commit 05846d5d48
2 changed files with 4 additions and 1 deletions

View file

@ -18,7 +18,7 @@
function phabricator_read_config_file($config) { function phabricator_read_config_file($config) {
$root = dirname(dirname(__FILE__)); $root = dirname(dirname(__FILE__));
$conf = @include $root.'/conf/'.$config.'.conf.php'; $conf = include $root.'/conf/'.$config.'.conf.php';
if ($conf === false) { if ($conf === false) {
throw new Exception("Failed to read config file '{$config}'."); throw new Exception("Failed to read config file '{$config}'.");
} }

View file

@ -16,6 +16,9 @@
* limitations under the License. * limitations under the License.
*/ */
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$include_path = ini_get('include_path'); $include_path = ini_get('include_path');
ini_set('include_path', $include_path.':'.dirname(__FILE__).'/../../'); ini_set('include_path', $include_path.':'.dirname(__FILE__).'/../../');
@include_once 'libphutil/src/__phutil_library_init__.php'; @include_once 'libphutil/src/__phutil_library_init__.php';