Switch to 'get_error_types()' to ensure availability in 'include/functions.php'.

The global in 'sanity_check()' was null... possibly due to circular requires?
This commit is contained in:
wn 2020-12-12 09:50:43 -06:00
parent 08a6f6bde2
commit 6bdf4a1a25
2 changed files with 24 additions and 22 deletions

View File

@ -4,6 +4,7 @@
require_once "functions.php";
function get_error_types() {
$ERRORS[0] = "";
$ERRORS[1] = __("This program requires XmlHttpRequest " .
@ -39,13 +40,14 @@
$ERRORS[14] = __("Plugin not found");
$ERRORS[15] = __("Encoding data as JSON failed");
}
if ($_REQUEST['mode'] == 'js') {
header("Content-Type: text/javascript; charset=UTF-8");
print "var ERRORS = [];\n";
foreach ($ERRORS as $id => $error) {
foreach (get_error_types() as $id => $error) {
$error = preg_replace("/\n/", "", $error);
$error = preg_replace("/\"/", "\\\"", $error);

View File

@ -327,7 +327,7 @@
function sanity_check() {
require_once 'errors.php';
global $ERRORS;
$ERRORS = get_error_types();
$error_code = 0;
$schema_version = get_schema_version(true);
@ -540,7 +540,7 @@
*/
function error_json($code) {
require_once "errors.php";
global $ERRORS;
$ERRORS = get_error_types();
@$message = $ERRORS[$code];