Index: kernel/application.php
===================================================================
--- kernel/application.php (revision 13203)
+++ kernel/application.php (working copy)
@@ -2067,7 +2067,7 @@
$a_location = $location;
$location = "Location: $location";
- if ($this->isDebugMode() && constOn('DBG_REDIRECT')) {
+ if ($this->isDebugMode() && (constOn('DBG_REDIRECT') || (constOn('DBG_RAISE_ON_WARNINGS') && $this->Application->Debugger->WarningCount))) {
$this->Debugger->appendTrace();
echo "<b>Debug output above!!!</b> Proceed to redirect: <a href=\"$a_location\">$a_location</a><br>";
}
Index: kernel/utility/debugger.php
===================================================================
--- kernel/utility/debugger.php (revision 13203)
+++ kernel/utility/debugger.php (working copy)
@@ -34,6 +34,13 @@
var $IsFatalError = false;
/**
+ * Counts warnings on the page
+ *
+ * @var int
+ */
+ var $WarningCount = 0;
+
+ /**
* Allows to track compile errors, like "stack-overflow"
*
* @var bool
@@ -1212,7 +1219,7 @@
$Debugger.DebugURL = '<?php echo $this->baseURL.'/debugger_responce.php?sid='.$this->rowSeparator.'&path='.urlencode($dbg_path); ?>';
$Debugger.EventURL = '<?php echo is_object($application->Factory) ? $application->HREF('dummy', '', Array ('pass' => 'm')) : ''; ?>';
<?php
- if ($this->IsFatalError || DBG_RAISE_ON_WARNINGS) {
+ if ($this->IsFatalError || (DBG_RAISE_ON_WARNINGS && $this->WarningCount)) {
echo '$Debugger.Toggle();';
}
if (DBG_TOOLBAR_BUTTONS) {
@@ -1352,6 +1359,11 @@
$this->Data[] = Array('no' => $errno, 'str' => $errstr, 'file' => $errfile, 'line' => $errline, 'context' => $errcontext, 'debug_type' => 'error');
$this->ProfilerData['error_handling']['ends'] = memory_get_usage();
$this->profilerAddTotal('error_handling', 'error_handling');
+
+ if ($errorType == 'Warning') {
+ $this->WarningCount++;
+ }
+
if (substr($errorType, 0, 5) == 'Fatal') {
$this->IsFatalError = true;
// append debugger report to data in buffer & clean buffer afterwards