diff --git a/_test/bootstrap.php b/_test/bootstrap.php index 732fef9ed272743411f04c8c1fec2e0d6e3a3e54..3f59db51562801672ad4df8b0b1ea22a3daeb685 100644 --- a/_test/bootstrap.php +++ b/_test/bootstrap.php @@ -68,6 +68,13 @@ $default_server_vars = array( 'REQUEST_TIME' => time(), ); +// fixup for $_SERVER when run from CLI, +// some values should be mocked for use by inc/init.php which is called here +// [ $_SERVER is also mocked in TestRequest::execute() ] +if (php_sapi_name() == 'cli') { + $_SERVER = array_merge($default_server_vars, $_SERVER); +} + // create temp directories mkdir(TMP_DIR); diff --git a/inc/init.php b/inc/init.php index 30eb1b2519948cbe1e21714530a420582f9f6651..248d27b9ca6e4e947d97f86bbd03906c655ba005 100644 --- a/inc/init.php +++ b/inc/init.php @@ -267,10 +267,10 @@ function init_lang($langCode) { $lang = array(); //load the language files - require_once(DOKU_INC.'inc/lang/en/lang.php'); + require(DOKU_INC.'inc/lang/en/lang.php'); if ($langCode && $langCode != 'en') { if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) { - require_once(DOKU_INC."inc/lang/$langCode/lang.php"); + require(DOKU_INC."inc/lang/$langCode/lang.php"); } } }