Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevents errors when Config::$db_show_debug is not set #8280

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/IntegrationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct(string $name, ?bool $ignore_errors = null)

$this->ignore_errors = $ignore_errors ?? !empty(Utils::$context['ignore_hook_errors']);

if (Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
Utils::$context['debug']['hooks'][] = $name;
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function __construct()
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0';
}

Config::$db_show_debug = null;
Config::$db_show_debug = false;

Db::load();

Expand Down
6 changes: 3 additions & 3 deletions Sources/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public static function loadTemplate(string|bool $template_name, array|string $st
}

if ($loaded) {
if (Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
Utils::$context['debug']['templates'][] = basename($template_dir) . '/' . $template_name . '.template.php';
}

Expand Down Expand Up @@ -406,7 +406,7 @@ public static function loadTemplate(string|bool $template_name, array|string $st
*/
public static function loadSubTemplate(string $sub_template_name, bool|string $fatal = false): void
{
if (Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
Utils::$context['debug']['sub_templates'][] = $sub_template_name;
}

Expand Down Expand Up @@ -1637,7 +1637,7 @@ function ($a, $b) {
}
}

if (Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
// Try to keep only what's useful.
$repl = [Config::$boardurl . '/Themes/' => '', Config::$boardurl . '/' => ''];

Expand Down
4 changes: 2 additions & 2 deletions Sources/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ function ($m) {
header('location: ' . str_replace(' ', '%20', $setLocation), true, $permanent ? 301 : 302);

// Debugging.
if (isset(Config::$db_show_debug) && Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
$_SESSION['debug_redirect'] = Db::$cache;
}

Expand Down Expand Up @@ -2254,7 +2254,7 @@ public static function getCallable(mixed $input, ?bool $ignore_errors = null): m
Utils::$context['instances'][$class] = new $class();

// Add another one to the list.
if (Config::$db_show_debug === true) {
if (!empty(Config::$db_show_debug)) {
if (!isset(Utils::$context['debug']['instances'])) {
Utils::$context['debug']['instances'] = [];
}
Expand Down
Loading