diff --git a/install.php b/install.php index b2764100ae6..d3ad6d358a6 100644 --- a/install.php +++ b/install.php @@ -163,10 +163,12 @@ function install_main() { * Verify if Drupal is installed. */ function install_verify_drupal() { - // Read the variable manually using the @ so we don't trigger an error if it fails. - $result = @db_query("SELECT value FROM {variable} WHERE name = '%s'", 'install_task'); - if ($result) { - return unserialize(db_result($result)); + if(db_table_exists('variable')) { + // Read the variable manually using the @ so we don't trigger an error if it fails. + $result = @db_query("SELECT value FROM {variable} WHERE name = '%s'", 'install_task'); + if ($result) { + return unserialize(db_result($result)); + } } } diff --git a/modules/user/user.module b/modules/user/user.module index 5ff9a35a361..35521618d73 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -519,15 +519,14 @@ function user_access($string, $account = NULL, $reset = FALSE) { if (!isset($account)) { $account = $user; } - // User #1 has all privileges: - if ($account->uid == 1) { + if ((int) ($account->uid ?? 0) === 1) { return TRUE; } // To reduce the number of SQL queries, we cache the user's permissions // in a static variable. - if (!isset($perm[$account->uid])) { + if (!isset($perm[$account->uid ?? 0]) && !empty($account->roles)) { $result = db_query("SELECT p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (". db_placeholders($account->roles) .")", array_keys($account->roles)); $perms = array(); diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 1a4a01fc5fd..26b1b45b6d1 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -153,18 +153,19 @@ * settings are used there. Settings defined here should not be * duplicated there so as to avoid conflict issues. */ -ini_set('arg_separator.output', '&'); -ini_set('magic_quotes_runtime', 0); -ini_set('magic_quotes_sybase', 0); -ini_set('session.cache_expire', 200000); -ini_set('session.cache_limiter', 'none'); -ini_set('session.cookie_lifetime', 2000000); -ini_set('session.gc_maxlifetime', 200000); -ini_set('session.use_cookies', 1); -ini_set('session.use_only_cookies', 1); -ini_set('session.use_trans_sid', 0); -ini_set('url_rewriter.tags', ''); - +if (PHP_VERSION_ID < 80000) { + ini_set('arg_separator.output', '&'); + ini_set('magic_quotes_runtime', 0); + ini_set('magic_quotes_sybase', 0); + ini_set('session.cache_expire', 200000); + ini_set('session.cache_limiter', 'none'); + ini_set('session.cookie_lifetime', 2000000); + ini_set('session.gc_maxlifetime', 200000); + ini_set('session.use_cookies', 1); + ini_set('session.use_only_cookies', 1); + ini_set('session.use_trans_sid', 0); + ini_set('url_rewriter.tags', ''); +} /** * If you encounter a situation where users post a large amount of text, and * the result is stripped out upon viewing but can still be edited, Drupal's