Skip to content

Commit

Permalink
Minor PHP5.4 fixes
Browse files Browse the repository at this point in the history
Explictly excludes E_STRICT from live error level and handle arrays in a backtrace
output, rather than trying to convert to string.
  • Loading branch information
simonwelsh committed Oct 16, 2012
1 parent 392543b commit 4ff8cff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/Core.php
Expand Up @@ -240,8 +240,8 @@ function sapphire_autoload($className) {
// This is necessary to force developers to acknowledge and fix
// notice level errors (you can override this directive in your _config.php)
if (Director::isLive()) {
if(defined('E_DEPRECATED')) error_reporting((E_ALL ^ E_NOTICE) ^ E_DEPRECATED);
else error_reporting(E_ALL ^ E_NOTICE);
if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
else error_reporting(E_ALL & ~E_NOTICE);
}
///////////////////////////////////////////////////////////////////////////////
// POST-MANIFEST COMMANDS
Expand Down
6 changes: 4 additions & 2 deletions dev/Backtrace.php
Expand Up @@ -130,7 +130,9 @@ static function full_func_name($item, $showArgs = false) {
if($showArgs && isset($item['args'])) {
$args = array();
foreach($item['args'] as $arg) {
if(!is_object($arg) || method_exists($arg, '__toString')) {
if(is_array($arg)) {
$args[] = 'Array';
} elseif(!is_object($arg) || method_exists($arg, '__toString')) {
$args[] = (string) $arg;
} else {
$args[] = get_class($arg);
Expand Down Expand Up @@ -175,4 +177,4 @@ static function get_rendered_backtrace($bt, $plainText = false, $ignoredFunction
return $result;
}

}
}

0 comments on commit 4ff8cff

Please sign in to comment.