| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | update.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | needs backport to D7, revisit after feature freeze, update.report.inc |
Issue Summary
Problem/Motivation
If a base theme attempts to hide itself to end users by adding hidden = TRUE to its .info file, a "Notice: Undefined index" warning is shown while viewing the available updates tab at /admin/reports/updates.
Steps to reproduce the problem:
- Install Drupal 8.x with the standard profile.
- Copy the update module's existing tests themes (core/modules/update/tests/themes/update_test_basetheme and core/modules/update/tests/themes/update_test_subtheme) to /themes (so they become manually testable).
- Edit line 4 of both update_test_basetheme and update_test_subtheme theme's .info file to read
hidden = FALSE - Add a new line to both update_test_basetheme and update_test_subtheme theme's .info file to read
"project = test"(required by update module) - Clear cache
- Visit: Appearance (admin/appearance)
- "Enable and set a default" the "Update test subtheme" theme.
- Visit: /admin/reports/updates
- NOTE: no bug
- Edit line 4 of the update_test_basetheme base theme's .info file to read
hidden = TRUE - Visit: /admin/reports/updates
- NOTE: Notice: Undefined index: update_test_basetheme in theme_update_report() (line 202 of core/modules/update/update.report.inc).
- Apply latest patch: #986888-54: Undefined index warning in "Available Updates List" with hidden=TRUE base themes
- NOTE: Warning is removed
Proposed resolution
The proposed solution and patch addresses this issue by, "...moving a !$file->status if statement lower down to allow building a list of enabled sub themes in more cases (i.e., always)." #986888-12: Undefined index warning in "Available Updates List" with hidden=TRUE base themes
Current workarounds for people who cannot use the patch are to avoid use of hidden = TRUE of the base theme in use.
Remaining tasks
- "...[fix] this first in 8.x and then in 7.x." #986888-42: Undefined index warning in "Available Updates List" with hidden=TRUE base themes
User interface changes
New features/functionality in the enabled themes (/admin/appearance) user interface, would allow sub themes's base theme to be hidden. Currently, basethemes must be remain visible to avoid "Notice: Undefined index" warnings.
Original report by glisteningC
Notice: Undefined index: adaptivetheme in theme_update_report() (line 201 of /usr/... /drupal7/modules/update/update.report.inc).
This error message (above) shows up when viewing the Available Updates List (tab).
Reports >> Available Updates >> List (tab) or
Home » Administration » Reports >> Available updates >> List
As far as I've seen, it only shows up when viewing the List 'tab'.
It shows up on two different Drupal installations.
Running Drupal 7.0-rc1.
Comments
#1
Thought this Issue Title is better than the first one I used.
#2
Hmmm, looks like it could be a bug in Drupal - I tracked it down to
hidden = TRUE, which I'm using inadaptivetheme.infoto hide the base theme from end users (such as on the Appearance page). We're meant to be able to use this in Themes in Drupal 7, see http://drupal.org/node/542202 which states this can be used for themes (maybe not base themes?).I'm moving this to the update module queue to get some feedback.
#3
Having the same error (notice) with 7.0 release:
Notice: Undefined index: adaptivetheme in theme_update_report() (line 201 of /home/XXX/XXX/XXX/modules/update/update.report.inc).#4
I have removed the hidden = TRUE flag from the info file and has been committed to CVS, I'll be releasing an updated version of the theme very soon, just trying to sort out the skinr module stuff which is holding up a release.
#5
Since it's a relatively simple change, the attached patch changes
_update_process_info_list()to process hidden themes which have enabled sub-themes. This eliminates the warning shown in this issue, and seems like a reasonable idea to me.#6
Got this message for Zen to.
#7
This moves the problem to
Notice: Undefined index: adaptivetheme in theme_update_report()
line 201 of modules/update/update.report.inc
#8
drbeaker:
I think you'll need to manually check for updates once for this to take effect -- (I think it's relying on insufficient cached data). Go to Reports >> Available Updates >> Updates (it's the tab in the upper-right) >> Check manually.
Please report the results.
#9
Getting this with Omega as well.
#10
Sorry, meant to also say that patch seems to work cleanly. No longer getting the notice error.
#11
drbeaker: The fact that you are still getting the error is because the cached data in {cache_update} is stale. You'll need to empty that table, say via
TRUNCATE TABLE `cache_update`in SQL.Okay, I do see how you could still get that undefined index error --- we don't properly build
$file->enabled_sub_themes(inupdate.compare.inc) in the case where the theme is both enabled and hidden. It seems unlikely, but is certainly possible if first you enable the theme and a later update sets hidden = TRUE.#12
drbeaker: This should fix your issue in #7.
Attached patch addresses the note in #11. The main change is moving a
!$file->statusif statement lower down to allow building a list of enabled subthemes in more cases (i.e., always).This might still need some more work, as the list of includes / depends / required by might be impacted by this.
#13
The last submitted patch, 986888-12-fix_undefined_index_with_hidden_base_themes.patch, failed testing.
#14
Reuploading to preserve the random testbot fail in #12.
#15
Has anybody had a chance to test this one out?
#16
Hi All,
I got a similar error message running the update script on a Drupal 7.0 instance.
Ran updates:
http://(my site).com/#overlay=admin/reports/updates
Got error message:
Notice: Undefined index: boron in theme_update_report() (line 201 of [path from root]/modules/update/update.report.inc).
Took a look at the 'update.report.inc' but can't see what might be triggering the error. Not on line 201 or anywhere else in the file.
I'm stumped.
- dave myers
#17
I'd like to test out this patch.
Not clear where and how to apply it (the specific file in which to insert the patch, and exactly where the insertion point is).
I'm no coder, so explicit instructions usually come in handy.
It appears that this thread mentions at least two files:
1. update.compare.inc
2. update.report.inc
Is the patch applied to one of these two files? If so, is there a specific point in the file in which to insert the patch?
Thanks,
-dave myers
P.S. My site is running on SQLite, not MySQL.
#18
#19
subscribe
#20
#14: 986888-14-fix_undefined_index_with_hidden_base_themes.patch queued for re-testing.
#21
The last submitted patch, 986888-14-fix_undefined_index_with_hidden_base_themes.patch, failed testing.
#22
Subscribing here too. This is showing for all Fusion core and sub themes.
#23
I've reuploaded #14 in the current -p1 diff format.
#24
And now it needs a reroll again. :)
Tagging as novice for the task of rerolling the Drupal 8.x patch on account of #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
If you need help rerolling this patch, you can come to core office hours or ask in #drupal-gitsupport on IRC.
#25
#26
The last submitted patch, 986888-now-with-core.patch, failed testing.
#27
Note that there is a testbot issue at the moment, which is why the patch failed. We'll want to re-test it once that is fixed.
#28
#25: 986888-now-with-core.patch queued for re-testing.
#29
The last submitted patch, 986888-now-with-core.patch, failed testing.
#30
#1346772: StatisticsLoggingTestCase->testLogging() fails with clean URLs in some environments again... someone please RTBC that patch before I hurt testbot. :)
#31
#32
The patch looks good to me. We should be able to add tests for this.
#33
Tests might have to wait for #953336: Contributed modules are not able to test theme-related functionality, but should be easy to write.
#34
I am getting this on Fusion_Core:
"Notice: Undefined index: fusion_core in theme_update_report() (line 200 of /var/www/patchxxxxxxx/modules/update/update.report.inc)."It's been a long time since this was an active thread - did I miss something ?
I am current on all code & modules as of this date...
#35
Please do not change version numbers
#36
#37
#12: 986888-12-fix_undefined_index_with_hidden_base_themes.patch queued for re-testing.
#38
#25: 986888-now-with-core.patch queued for re-testing.
#39
The last submitted patch, 986888-now-with-core.patch, failed testing.
#40
Looking into writing an automated test.
#41
Getting this error on adaptive subtheme in a profile.
#42
I think we are fixing this first in 8.x and then in 7.x.
@carsonblack, it's been awhile. If you want to tackle this again, just post a note. :) Thanks for trying. Tests can be tricky. Otherwise it's available.
#43
I had to enable the subtheme as a workaround. Can't delete it because it is part of a profile.
#44
I rerolled the patch from post 25, "986888-now-with-core.patch" to apply cleanly to commit 77f0384.
#45
I rerolled the patch from post 25, "986888-now-with-core.patch" to apply cleanly to commit 77f0384.
#46
confirming that patch in #45 removes the warning for base themes with the hidden = TRUE.
status update for automated tests, which are still needed.
#47
here's a pass at adding an automated test with patch in #45. this tests specifically for the undefined index error and the hidden base theme and sub theme combination.
#48
Thanks @bdone!
One thing we want to do in general is assert the correct, expected behavior rather than merely asserting that there is no error message. Otherwise, it could be broken in a different way but still pass the test.
Another thing to keep in mind is that the error reporting settings can vary from site to site, so if we are using
assertText()to check whether an error was reported, we need to make sure the error would be reported. See ErrorHandlerTest for an illustration of how the error handling settings can affect what messages are displayed. In general, I recommend against asserting the absence of an error message, but let's start by looking at the test-only patch (like we discussed in IRC) to make sure it provides coverage.Another thing we could try would be to test the function directly--call
update_process_info_list()within the test method, instead of visiting a page where it is called with the browser. That way, the error should hopefully be raised in the test environment rather than the child environment, which would cause the test to fail.+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -262,6 +262,37 @@ function testUpdateShowDisabledThemes() {
+ /**
+ * Tests that hidden base themes do not report a specified undefined
+ * index error in the available updates report.
+ */
+ function testUpdateHiddenBaseThemeError() {
The summary should be one line of 80 characters or fewer. I'd suggest broadening the method's purpose a little to test hidden base themes in general, like:
/*** Tests updates with a hidden base theme.
*/
function testUpdateHiddenBaseTheme() {
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -262,6 +262,37 @@ function testUpdateShowDisabledThemes() {
+ $this->assertNoText(t($message), t('The hidden base theme, update_test_basetheme, did not produce error message: !message', array('!message' => $message)));
In general, assertion message texts should not use
t(). See: http://drupal.org/simpletest-tutorial-drupal7#tAlso, for
assertText()andassertNoText(), the default message is usually sufficiently clear, so we can actually leave off the$messageparameter here.#49
Thanks for the help and excellent feedback @xjm! Here's another pass at it.
This one incorporates all of your suggestions and (hopefully) gets us a bit closer.
#50
@bdone interdiff please (unless it's a reroll that cannot make one because of merges or conflicts)
#51
@YesCT: didn't think an interdiff was needed, because i've not actually touched the original patch. i did re-name it, which was probably my mistake. so in #49, 986888-49-complete.patch is actually 986888-44-reroll.patch.
Here's an attempt at fixing that, w/ out re-naming the original patch. would an interdiff still be needed?
#52
okay, got a bit confused about which interdiff to provide here. attaching one between 47 and 49 as suggested by @Cottser in #drupal. thanks for helping clear it up!
#53
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -262,13 +262,15 @@ function testUpdateShowDisabledThemes() {
- /**
- * Tests that hidden base themes do not report a specified undefined
- * index error in the available updates report.
+ /**
+ * Tests updates with a hidden base theme.
looks like this address. the 80 char. mentioned by xjm. in point 1. of comment #48
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -262,13 +262,15 @@ function testUpdateShowDisabledThemes() {
- function testUpdateHiddenBaseThemeError() {
+ function testUpdateHiddenBaseTheme() {
and this is good for being more general.
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -283,14 +285,41 @@ function testUpdateHiddenBaseThemeError() {
- $this->assertNoText(t($message), t('The hidden base theme, update_test_basetheme, did not produce error message: !message', array('!message' => $message)));
...
+ $this->assertTrue(!empty($projects['update_test_basetheme']), 'Valid base theme (update_test_basetheme) was found.');
this is both more general than looking for not an error, is looking for correct function. and also takes out the t() in the second argument to the assert.
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined@@ -283,14 +285,41 @@ function testUpdateHiddenBaseThemeError() {
+ update_process_info_list($projects, $theme_data, 'theme', TRUE);
looks like update_process_info_list is called directly, as requested.
Summary
as best I can tell, the improvements have been made. (looking at the interdiff.)
I am confused though as the recent comment says the patch is the same as 44, but that is before xjm asked for the changes. So I think in comment #51 the test only patch has the improvements, but the complete patch does not contain the test. the "patch" should be both the fix and the tests, not just the fix. (when the committer, commits it, they commit the patch, so that should have both the tests and the patch)
I think there was some confusion there. What we need here is a new patch that has both the tests and the fix. probably to make it easy for the drupal core maintainers, is to include a justs tests along with that (which will probably be a duplicate of tests patch in #51 but that is ok.)
#54
hopefully this incorporates feedback from @YesCT correctly...
#55
...any luck with the D7 port?...still getting the "Notice: Undefined index: ...theme in theme_update_report() (line 202 of ...\modules\update\update.report.inc)" after (986888-44-reroll_0) patch, even when I enable the base themes (AdaptiveTheme ones) involved...
#56
ok. we are getting completely confused with all these patches. @bdone dont worry much. we will sort out interdiffs on the next issue. :)
I went through this, and test and complete patch in 54 are ok.
#57
I really think this should be fixed by #1297856: Base themes should be required dependencies of subthemes and/or #1067408: Themes need an installation status instead of adding additional complexity around the system to check for updates of things that aren't registered in the system at all.
#58
@catch how about adding a @todo to convert to those once the are fixed? Or would that conflict with those issues and slow down them?
Those issues are not moving very quickly, and have their own dependencies.
Those issues or their dependencies don't look back portable to d7, would we still use an approach like this one in d7?
I suppose waiting a week or two to see how feature completion shakes down feb 18 in those issues is not too long to wait.
Updating tags (this has tests, and to revisit)
#59
Hmm given this is a Drupal 7 bug report I don't think we have a choice but to commit it to 8.x then refactor if those other two get fixed.
Back to RTBC.
#60
Committed/pushed to 8.x, thanks!
#61
Backported #54 to D7.
#62
The last submitted patch, 986888-61-available-updates-list.patch, failed testing.