Skip to content

Commit

Permalink
Silence debug prints clearly not meant for CLI
Browse files Browse the repository at this point in the history
- FIX: e_array::unserialize() HTML vomit in CLI mode
- FIX: e107_debug_shutdown() HTML vomit because $error_handler was not global
  • Loading branch information
Deltik committed Jan 18, 2020
1 parent be8f2bb commit 52116ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions class2.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
// D: Setup PHP error handling
// (Now we can see PHP errors) -- but note that DEBUG is not yet enabled!
//
global $error_handler;
$error_handler = new error_handler();

//
Expand Down Expand Up @@ -2412,8 +2413,8 @@ function force_userupdate($currentUser)
class error_handler
{

var $errors;
var $debug = false;
public $errors = [];
public $debug = false;
protected $xdebug = false;
protected $docroot = '';
protected $label = array();
Expand Down
2 changes: 1 addition & 1 deletion e107_handlers/core_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public function unserialize($sourceArrayData)

// e107::getDebug()->log("Json data found");

if(json_last_error() != JSON_ERROR_NONE && (e_DEBUG === true))
if(json_last_error() != JSON_ERROR_NONE && e_DEBUG === true && !e107::isCli())
{
echo "<div class='alert alert-danger'><h4>e107::unserialize() Parser Error (json)</h4></div>";
echo "<pre>";
Expand Down

0 comments on commit 52116ad

Please sign in to comment.