[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] config: Fix fatal error on missing or unreadable config file by defining...

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a0d87e5e4b5_381921348465b@gitlab-sidekiq-low-urgency-cpu-bound-v2-57f58cbbc5-2qx22.mail>

Jonny Bradley pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
1da6e98a by Jonny Bradley at 2026-05-20T10:07:30+00:00
[FIX] config: Fix fatal error on missing or unreadable config file by defining a var before using it
---
* [FIX] config: Fix fatal error on missing or unreadable config file by defining the `$fail` closure before using it.
Regression from !8574 i believe.

See merge request tikiwiki/tiki!10252


(cherry picked from commit 01c10e7202e90bc980114b8374f648a9de21ecff)

90a1c3cb [FIX] config: Fix fatal error on missing or unreadable config file by defining...

Co-authored-by: Jonny Bradley <[email protected]>
- - - - -


1 changed file:

- db/tiki-db.php


Changes:

=====================================
db/tiki-db.php
=====================================
@@ -18,6 +18,20 @@ use Tiki\TikiInit;
 
 require_once('lib/init/initlib.php');
 
+$fail = static function (string $msg, int $code = 1001): void {
+    if (defined('TIKI_CONSOLE')) {
+        throw new ConsoleSetupException($msg, $code);
+    }
+    if (PHP_SAPI === 'cli') {
+        fwrite(STDERR, $msg . PHP_EOL);
+        exit(1);
+    }
+    header('HTTP/1.0 503 Service Unavailable', true, 503);
+    header('Retry-After: 300');
+    echo $msg;
+    exit(1);
+};
+
 // Define lang and load translation functions
 if (! empty($_REQUEST['lang'])) {
     $language = $prefs['site_language'] = $prefs['language'] = $_REQUEST['lang'];
@@ -286,17 +300,3 @@ function mydumpstack($stack)
     }
     return $o;
 }
-
-$fail = static function (string $msg, int $code = 1001): void {
-    if (defined('TIKI_CONSOLE')) {
-        throw new ConsoleSetupException($msg, $code);
-    }
-    if (PHP_SAPI === 'cli') {
-        fwrite(STDERR, $msg . PHP_EOL);
-        exit(1);
-    }
-    header('HTTP/1.0 503 Service Unavailable', true, 503);
-    header('Retry-After: 300');
-    echo $msg;
-    exit(1);
-};



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1da6e98adfc0153b0547054286c18b9140fec842

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1da6e98adfc0153b0547054286c18b9140fec842
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.