Diff of /moodle/lib/weblib.php
Parent Directory
|
Revision Log
|
Patch
|
By tjhunt:
unit tests: MDL-20398 spurious exceptions when $CFG->debugdisplay is false
|
| 3136 |
* @return bool |
* @return bool |
| 3137 |
*/ |
*/ |
| 3138 |
function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) { |
function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) { |
| 3139 |
global $CFG; |
global $CFG, $UNITTEST; |
| 3140 |
|
|
| 3141 |
if (empty($CFG->debug) || $CFG->debug < $level) { |
if (empty($CFG->debug) || $CFG->debug < $level) { |
| 3142 |
return false; |
return false; |
| 3151 |
$backtrace = debug_backtrace(); |
$backtrace = debug_backtrace(); |
| 3152 |
} |
} |
| 3153 |
$from = format_backtrace($backtrace, CLI_SCRIPT); |
$from = format_backtrace($backtrace, CLI_SCRIPT); |
| 3154 |
if ($CFG->debugdisplay) { |
if ($CFG->debugdisplay || empty($UNITTEST->running)) { |
| 3155 |
|
// When the unit tests are running, any call to trigger_error |
| 3156 |
|
// is intercepted by the test framework and reported as an exception. |
| 3157 |
|
// Therefore, we cannot use trigger_error during unit tests. |
| 3158 |
|
// At the same time I do not think we should just discard those messages, |
| 3159 |
|
// so displaying them on-screen seems like the only option. (MDL-20398) |
| 3160 |
if (!defined('DEBUGGING_PRINTED')) { |
if (!defined('DEBUGGING_PRINTED')) { |
| 3161 |
define('DEBUGGING_PRINTED', 1); // indicates we have printed something |
define('DEBUGGING_PRINTED', 1); // indicates we have printed something |
| 3162 |
} |
} |
|
|
Legend:
| Removed from v.1.1339 |
|
| changed lines |
| |
Added in v.1.1340 |
|
|