Skip to content

Commit

Permalink
Merge branch 'MDL-38041_master-fix' of git://github.com/dmonllao/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed May 6, 2013
2 parents f2dc4d2 + 1d9ec4c commit fc17f75
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/behat/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ function behat_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
return true;
}

// This error handler receives E_ALL | E_STRICT, running the behat test site the debug level is
// set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current
// error_reporting() value does not include one of those levels is because it has been forced through
// the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value.
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING);
foreach ($respect as $respectable) {

// If the current value does not include this kind of errors and the reported error is
// at that level don't print anything.
if ($errno == $respectable && !(error_reporting() & $respectable)) {
return true;
}
}

// Using the default one in case there is a fatal catchable error.
default_error_handler($errno, $errstr, $errfile, $errline, $errcontext);

Expand Down

0 comments on commit fc17f75

Please sign in to comment.