From d049fd45a557e5c32793fa463d6888af3f1bcd76 Mon Sep 17 00:00:00 2001
From: skodak
Date: Sun, 22 Jul 2007 17:34:41 +0000
Subject: [PATCH] MDL-10566 do not redirect when dubug message printed; do not
redirect also in DEBUG_ALL mode when error found - the DEBUG_DEVELOPER is not
used by all developers all the time ;-)
---
lib/weblib.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/weblib.php b/lib/weblib.php
index dd7295775f..dbde8630cb 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -5437,8 +5437,9 @@ function redirect($url, $message='', $delay=-1) {
/// At developer debug level. Don't redirect if errors have been printed on screen.
/// Currenly only works in PHP 5.2+; we do not want strict PHP5 errors
- $error = error_get_last();
- $errorprinted = debugging('', DEBUG_DEVELOPER) && $CFG->debugdisplay && !empty($error) && ($error['type'] & DEBUG_DEVELOPER);
+ $lasterror = error_get_last();
+ $error = defined('DEBUGGING_PRINTED') or (!empty($lasterror) && ($lasterror['type'] & DEBUG_DEVELOPER));
+ $errorprinted = debugging('', DEBUG_ALL) && $CFG->debugdisplay && $error;
if ($errorprinted) {
$message = "Error output, so disabling automatic redirect.
" . $message;
}
@@ -6248,6 +6249,9 @@ function debugging($message='', $level=DEBUG_NORMAL) {
$CFG->debugdisplay = ini_get('display_errors');
}
if ($CFG->debugdisplay) {
+ if (!defined('DEBUGGING_PRINTED')) {
+ define('DEBUGGING_PRINTED', 1); // indicates we have printed something
+ }
notify($message . $from, 'notifytiny');
} else {
trigger_error($message . $from, E_USER_NOTICE);
--
2.39.5