- Issue created by @JOINSO
- First commit to issue fork.
- last update
over 1 year ago 2,151 pass - Status changed to Needs review
over 1 year ago 11:30am 24 May 2023 - ๐ช๐ธSpain JOINSO Sabadell
Hi!
I add more info:
Active themes:
MY_THEME (a subtheme of Adaptive Themes(AT))
AT Admin 7.x-3.5
AT Core 7.x-3.5
Bartik 7.97
Seven 7.97
If try to go to:
/admin/appearance/settings/bartik
I get an access denied,
but now if I go to /admin/appearance/settings/seven - ๐ช๐ธSpain JOINSO Sabadell
More info.
Making some debug I get this:
[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => sites/all/themes/adaptivetheme/at_admin/adaptivetheme_admin.info
[filename] => sites/all/themes/adaptivetheme/at_admin/adaptivetheme_admin.info
[name] => adaptivetheme_admin
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => sites/all/themes/adaptivetheme/at_core/adaptivetheme.info
[filename] => sites/all/themes/adaptivetheme/at_core/adaptivetheme.info
[name] => adaptivetheme
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => sites/all/themes/adaptivetheme/at_subtheme/adaptivetheme_subtheme.info
[filename] => sites/all/themes/adaptivetheme/at_subtheme/adaptivetheme_subtheme.info
[name] => adaptivetheme_subtheme
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => themes/bartik/bartik.info
[filename] => themes/bartik/bartik.info
[name] => bartik
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => sites/all/themes/f4r/f4r.info
[filename] => sites/all/themes/f4r/f4r.info
[name] => f4r
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => themes/garland/garland.info
[filename] => themes/garland/garland.info
[name] => garland
[status] => 0
)
[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => themes/seven/seven.info
[filename] => themes/seven/seven.info
[name] => seven
[status] => 0
)[26-May-2023 07:43:11 Europe/Paris] Theme:stdClass Object
(
[uri] => themes/stark/stark.info
[filename] => themes/stark/stark.info
[name] => stark
[status] => 0
)So, all my themes are disabled, and this:
$theme_group_titles = array(
'enabled' => format_plural(count($theme_groups['enabled']), 'Enabled theme', 'Enabled themes'),
);Becomes not safe.
So, I am going to study how to enable themes....
A suggestion to improve this:
if all themes are disabled, does not let the admin page fails. - ๐ช๐ธSpain JOINSO Sabadell
And more info:
In modules/system/system.module:
function function system_rebuild_theme_data() {
....
system_get_files_database($themes, 'theme');
...
}
I debug data before and after calling "system_get_files_database", and I get this in PHP 7.4:[26-May-2023 08:44:06 Europe/Paris] Before Theme (adaptivetheme) :
[26-May-2023 08:44:06 Europe/Paris] Before Theme (adaptivetheme_admin) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (adaptivetheme_subtheme) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (bartik) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (f4r) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (garland) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (seven) :
[26-May-2023 08:44:07 Europe/Paris] Before Theme (stark) :
[26-May-2023 08:44:07 Europe/Paris] After Theme (adaptivetheme) :1
[26-May-2023 08:44:07 Europe/Paris] After Theme (adaptivetheme_admin) :1
[26-May-2023 08:44:07 Europe/Paris] After Theme (adaptivetheme_subtheme) :0
[26-May-2023 08:44:07 Europe/Paris] After Theme (bartik) :1
[26-May-2023 08:44:07 Europe/Paris] After Theme (f4r) :1
[26-May-2023 08:44:07 Europe/Paris] After Theme (garland) :0
[26-May-2023 08:44:07 Europe/Paris] After Theme (seven) :1
[26-May-2023 08:44:07 Europe/Paris] After Theme (stark) :0And this in PHP 8.1:
[26-May-2023 08:46:34 Europe/Paris] Before Theme (adaptivetheme) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (adaptivetheme_admin) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (adaptivetheme_subtheme) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (bartik) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (f4r) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (garland) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (seven) :
[26-May-2023 08:46:34 Europe/Paris] Before Theme (stark) :
[26-May-2023 08:46:34 Europe/Paris] After Theme (adaptivetheme) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (adaptivetheme_admin) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (adaptivetheme_subtheme) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (bartik) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (f4r) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (garland) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (seven) :0
[26-May-2023 08:46:34 Europe/Paris] After Theme (stark) :0 - ๐ช๐ธSpain JOINSO Sabadell
Now this is solved fixing the database status in themes, but still getting "access denied" in some themes....
- ๐ช๐ธSpain JOINSO Sabadell
Just "disable/enable" clean urls or "clear cache" to fix.
So, in brief:
This is not safe in PHP 8.1:
$theme_group_titles = array(
'enabled' => format_plural(count($theme_groups['enabled']), 'Enabled theme', 'Enabled themes'),
);If all the themes are disabled (status=0 in database).
- Status changed to Postponed: needs info
about 1 year ago 9:04pm 30 October 2023 - ๐ธ๐ฐSlovakia poker10
Thanks for reporting this. I do not think you can disable all themes via Drupal 7 UI. Therefore we need more information how you ended up with all themes disabled. If this was an error like deleting all themes, or similar, then it is not a bug in Drupal core and it is unlikely we are going to commit this patch. Thanks!
- ๐ฌ๐งUnited Kingdom oily Greater London
andrew.farquharson โ made their first commit to this issueโs fork.
- last update
about 1 year ago 2,163 pass - ๐ฌ๐งUnited Kingdom oily Greater London
HI @poker10, I tested on a fresh cloned installation. I unticked the logo setting for the default bartik theme https://www.drupal.org/files/issues/2023-11-17/clean-install-bartik-theme.png โ . That triggered an error in recent log messages. Recent log messages โ Two errors were triggered in the system.admin.inc file. First of 2 errors โ The error was due to null argument for the array in in_array() functions Error message details โ
This is a known PHP 8.1 issue. Fix for in_array function issue
- last update
about 1 year ago 2,163 pass - last update
about 1 year ago 2,124 pass - last update
about 1 year ago 2,163 pass - ๐ธ๐ฐSlovakia poker10
Thanks @andrew.farquharson, but I think that what you reported is a slightly different issue than the one mentioned in the IS. The issue from @JOINSO is with
$theme_groups['enabled']
being empty.Anyway, I also have a clean Drupal 7.98 install and the default frontent theme set to Bartik. Running on PHP 8.1 and unchecked the Logo, there are no messages in my watchdog. Are there any other steps/configuration changes needed?
The source of the mentioned typeError in your watchdog seem to be this:
$features = $themes[$key]->info['features'];
(the features are empty). But I do not think that the features can be empty for Bartik theme, because there are no features in the .info file, so Drupal will initialize the default array:$themes[$key]->info = drupal_parse_info_file($theme->uri) + $defaults;
And the
$defaults['features']
are:function _system_default_theme_features() { return array( 'logo', 'favicon', 'name', 'slogan', 'node_user_picture', 'comment_user_picture', 'comment_user_verification', 'main_menu', 'secondary_menu', ); }
- ๐ฌ๐งUnited Kingdom oily Greater London
@poker10 Hi, yes the other step was to save the configuration of bartik after deselecting the logo setting. I am not sure if you assumed that step or did exactly as i stated? If you could try it and perhaps deselect a few more of the settings, saving the configuration and re-checking the recent errors, please. I will try to reproduce the error once again if you cannot. Thanks.
- ๐ฌ๐งUnited Kingdom oily Greater London
@poker10 I just did a drush site-install using standard profile. I have switched to the 7.x branch. I deleted all recent log messages. Then deselected the logo setting for bartik and saved the configuration. Then went to reports> recent log messages. The php typeerror was the most recent entry and also the only error.
- ๐ธ๐ฐSlovakia poker10
Thanks @andrew.farquharson. This looks like a bug in the color module, not in the function which your changes in MR are trying to fix. Color module displays a preview which contains the logo. This JS (
themes/bartik/color/preview.js
) is modifying the preview:// Change the logo to be the real one. if (!this.logoChanged) { $('#preview #preview-logo img').attr('src', Drupal.settings.color.logo); this.logoChanged = true; } // Remove the logo if the setting is toggled off. if (Drupal.settings.color.logo == null) { $('div').remove('#preview-logo'); }
The problem with this code seems like that when
Drupal.settings.color.logo
is NULL (e.g. the checkbox is unchecked), it will generate this URL for the logo:admin/appearance/settings/null
. This URL will generate all warnings and errors. We should fix this in the JS, not in themodules/system/system.admin.inc
because that will only hide the real problem.So I recommend these next steps:
- Revert the changes from the MR and keep only the initial changes made by @JOINSO, as this issue is unrelated
- Create a new issue with this color module bug with all information needed (feel free to link it here)
- We can take a look in the new issue
Thanks!
- ๐ฌ๐งUnited Kingdom oily Greater London
@poker10
(e.g. the checkbox is unchecked)
There are, in fact, three checkboxes which each is deselected while the other 2 are selected will trigger the error. โ
The errors only occurs when using PHP 8.1 with Drupal 7.x. The fix I have applied is one that is used in PHP applications that rely on PHP 8.1, across the board. e.g. Laravel. Every previous version of PHP does not expose any faults in the code, color module, bartik or anywhere else. So I would say this is not a color module issue so much as a PHP 8.1 issue. I have applied a PHP 8.1 fix. It is extremely simple and effective, though I have not tested all the possible deselect permutations yet with the fix, only without the fix: they all trigger the same error.
- ๐ธ๐ฐSlovakia poker10
The errors only occurs when using PHP 8.1 with Drupal 7.x.
I explained that in the other issue already. This was a problem also earlier, but PHP 8+ introduced TypeErrors so some warnings are now errors. Before it was working, but the warnings were there as well.
I would say this is not a color module issue so much as a PHP 8.1 issue.
This is not true, I have debugged and explained that in #16.
So please, let's focus on my recommendations from #16. Discussing this here is out of scope of the original problem, see: https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett... โ , so you need to create a new issue.
- ๐ฌ๐งUnited Kingdom oily Greater London
@poker10 i regard this as a waste of time now. Good luck.
The website encountered an unexpected error. Try again later.
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 243 of core/modules/field_ui/src/Form/FieldConfigEditForm.php).
Drupal\field_ui\Form\FieldConfigEditForm->form() (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)I am facing this error when I try to edit the field.