Skip to content

Commit

Permalink
Fix notices when using dw CLI
Browse files Browse the repository at this point in the history
On the commandline several global variables might not be set. Accessing
them might generate an E_NOTICE.
  • Loading branch information
micgro42 committed Feb 28, 2019
1 parent 4593dbd commit fb97a12
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inc/init.php
Expand Up @@ -108,7 +108,10 @@ function delta_time($start=0) {
if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t");

// define cookie and session id, append server port when securecookie is configured FS#1664
if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:'')));
if (!defined('DOKU_COOKIE')) {
$serverPort = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '';
define('DOKU_COOKIE', 'DW' . md5(DOKU_REL . (($conf['securecookie']) ? $serverPort : '')));
}


// define main script
Expand Down Expand Up @@ -140,7 +143,8 @@ function delta_time($start=0) {
@ini_set('pcre.backtrack_limit', '20971520');

// enable gzip compression if supported
$conf['gzip_output'] &= (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false);
$httpAcceptEncoding = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
$conf['gzip_output'] &= (strpos($httpAcceptEncoding, 'gzip') !== false);
global $ACT;
if ($conf['gzip_output'] &&
!defined('DOKU_DISABLE_GZIP_OUTPUT') &&
Expand Down

0 comments on commit fb97a12

Please sign in to comment.