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:

  1. Install Drupal 8.x with the standard profile.
  2. 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).
  3. Edit line 4 of both update_test_basetheme and update_test_subtheme theme's .info file to read hidden = FALSE
  4. 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)
  5. Clear cache
  6. Visit: Appearance (admin/appearance)
  7. "Enable and set a default" the "Update test subtheme" theme.
  8. Visit: /admin/reports/updates
  9. NOTE: no bug
  10. Edit line 4 of the update_test_basetheme base theme's .info file to read hidden = TRUE
  11. Visit: /admin/reports/updates
  12. NOTE: Notice: Undefined index: update_test_basetheme in theme_update_report() (line 202 of core/modules/update/update.report.inc).
  13. Apply latest patch: #986888-54: Undefined index warning in "Available Updates List" with hidden=TRUE base themes
  14. 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

  1. "...[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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

glisteningC’s picture

Title: "Undefined Index" error message » Undefined index: adaptivetheme in theme_update_report()

Thought this Issue Title is better than the first one I used.

Jeff Burnz’s picture

Title: Undefined index: adaptivetheme in theme_update_report() » Undefined index for base theme in theme_update_report() when the base theme uses hidden = true
Project: AdaptiveTheme » Drupal core
Version: 7.x-1.x-dev » 7.x-dev
Component: Code » update.module

Hmmm, looks like it could be a bug in Drupal - I tracked it down to hidden = TRUE, which I'm using in adaptivetheme.info to 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.

Abilnet’s picture

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).

Jeff Burnz’s picture

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.

bfroehle’s picture

Status: Active » Needs review
FileSize
1.35 KB

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.

olamaekle’s picture

Got this message for Zen to.

drbeaker’s picture

This moves the problem to

Notice: Undefined index: adaptivetheme in theme_update_report()

line 201 of modules/update/update.report.inc

bfroehle’s picture

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.

himerus’s picture

Getting this with Omega as well.

himerus’s picture

Sorry, meant to also say that patch seems to work cleanly. No longer getting the notice error.

bfroehle’s picture

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 (in update.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.

bfroehle’s picture

drbeaker: This should fix your issue in #7.

Attached patch addresses the note in #11. The main change is moving a !$file->status if 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.

Status: Needs review » Needs work

The last submitted patch, 986888-12-fix_undefined_index_with_hidden_base_themes.patch, failed testing.

bfroehle’s picture

Status: Needs work » Needs review
FileSize
2.71 KB

Reuploading to preserve the random testbot fail in #12.

bfroehle’s picture

Has anybody had a chance to test this one out?

davydog’s picture

Title: Undefined index for base theme in theme_update_report() when the base theme uses hidden = true » Notice: Undefined index: boron in theme_update_report() (line 201 of [path from root]/modules/update/update.report.inc).
Version: 7.x-dev » 7.0
Issue tags: +D7, +update.report.inc

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

davydog’s picture

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.

bfroehle’s picture

Title: Notice: Undefined index: boron in theme_update_report() (line 201 of [path from root]/modules/update/update.report.inc). » Undefined index warning in "Available Updates List" with hidden=TRUE base themes
Version: 7.0 » 8.x-dev
Issue tags: -D7 +Needs backport to D7
jmones’s picture

subscribe

webci274’s picture

Status: Needs review » Needs work
Issue tags: +Needs backport to D7, +update.report.inc

The last submitted patch, 986888-14-fix_undefined_index_with_hidden_base_themes.patch, failed testing.

MrPhilbert’s picture

Subscribing here too. This is showing for all Fusion core and sub themes.

bfroehle’s picture

Status: Needs work » Needs review
FileSize
2.71 KB

I've reuploaded #14 in the current -p1 diff format.

xjm’s picture

Status: Needs review » Needs work
Issue tags: +Novice

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.

bfroehle’s picture

Status: Needs work » Needs review
Issue tags: -Novice
FileSize
2.73 KB

Status: Needs review » Needs work

The last submitted patch, 986888-now-with-core.patch, failed testing.

xjm’s picture

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.

bfroehle’s picture

Status: Needs work » Needs review
Issue tags: -Needs backport to D7, -update.report.inc

#25: 986888-now-with-core.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs backport to D7, +update.report.inc

The last submitted patch, 986888-now-with-core.patch, failed testing.

xjm’s picture

#1346772: StatisticsLoggingTestCase->testLogging() fails with clean URLs in some environments again... someone please RTBC that patch before I hurt testbot. :)

bfroehle’s picture

Status: Needs work » Needs review
xjm’s picture

Issue tags: +Needs tests

The patch looks good to me. We should be able to add tests for this.

bfroehle’s picture

Tests might have to wait for #953336: Contributed modules are not able to test theme-related functionality, but should be easy to write.

netdesignate’s picture

Version: 8.x-dev » 7.14
Assigned: Unassigned » netdesignate

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...

marcingy’s picture

Version: 7.14 » 8.x-dev

Please do not change version numbers

marcingy’s picture

Assigned: netdesignate » Unassigned
brephraim’s picture

kbasarab’s picture

#25: 986888-now-with-core.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests, +Needs backport to D7, +update.report.inc

The last submitted patch, 986888-now-with-core.patch, failed testing.

carsonblack’s picture

Assigned: Unassigned » carsonblack

Looking into writing an automated test.

sonicthoughts’s picture

Version: 8.x-dev » 7.x-dev

Getting this error on adaptive subtheme in a profile.

YesCT’s picture

Version: 7.x-dev » 8.x-dev
Assigned: carsonblack » Unassigned

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.

sonicthoughts’s picture

I had to enable the subtheme as a workaround. Can't delete it because it is part of a profile.

grwgreg’s picture

FileSize
3.73 KB

I rerolled the patch from post 25, "986888-now-with-core.patch" to apply cleanly to commit 77f0384.

grwgreg’s picture

Status: Needs work » Needs review
FileSize
3.73 KB

I rerolled the patch from post 25, "986888-now-with-core.patch" to apply cleanly to commit 77f0384.

bdone’s picture

Status: Needs review » Needs work

confirming that patch in #45 removes the warning for base themes with the hidden = TRUE.

status update for automated tests, which are still needed.

bdone’s picture

Status: Needs work » Needs review
FileSize
5.4 KB

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.

xjm’s picture

Status: Needs review » Needs work

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.

  1. +++ 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() {
    
  2. +++ 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#t

    Also, for assertText() and assertNoText(), the default message is usually sufficiently clear, so we can actually leave off the $message parameter here.

xjm’s picture

Issue summary: View changes

bdone: added issue summary

bdone’s picture

Status: Needs work » Needs review
FileSize
5.25 KB
1.52 KB

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.

YesCT’s picture

@bdone interdiff please (unless it's a reroll that cannot make one because of merges or conflicts)

bdone’s picture

@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?

bdone’s picture

FileSize
2.82 KB

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!

YesCT’s picture

Status: Needs review » Needs work
+++ 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.)

bdone’s picture

Status: Needs work » Needs review
FileSize
1.52 KB
5.25 KB
1.52 KB

hopefully this incorporates feedback from @YesCT correctly...

  • 986888-54-tests.patch: a duplicate of tests patch in #51.
  • 986888-54-complete.patch: original patch from #44, including #54 tests patch.
  • interdiff-54-51.txt: an interdiff from #54 to #51.
siretfeL’s picture

...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...

YesCT’s picture

Status: Needs review » Reviewed & tested by the community

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.

catch’s picture

Status: Reviewed & tested by the community » Needs work

I really think this should be fixed by #1297856: Base themes should be required dependencies of subthemes and/or #1067408: Themes do not have 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.

YesCT’s picture

@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)

catch’s picture

Status: Needs work » Reviewed & tested by the community

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.

catch’s picture

Issue summary: View changes

Updated issue summary.

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed/pushed to 8.x, thanks!

dcam’s picture

Status: Patch (to be ported) » Needs review
FileSize
5.06 KB
1.38 KB

Backported #54 to D7.

Status: Needs review » Needs work
Issue tags: -Needs backport to D7, -update.report.inc, -Revisit after feature freeze

The last submitted patch, 986888-61-available-updates-list.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

bdone: updated next steps and manual tests link to latest patch

YesCT’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 61: 986888-61-available-updates-list-tests-only.patch, failed testing.

dcam’s picture

Status: Needs work » Needs review

The last submitted patch, 61: 986888-61-available-updates-list.patch, failed testing.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

The last submitted patch, 61: 986888-61-available-updates-list.patch, failed testing.

dcam’s picture

Status: Reviewed & tested by the community » Needs review

Oops, this wasn't RTBC anyway. I didn't pay attention while going through and fixing all the random test failures on issue that actually are RTBC.

Kebz’s picture

Is this the same??
My system is telling me that I have "out of date" modules. So I then click on the link and see that it's listing disabled items or a module I'm not ready to update to. So I proceed and click on the "list" tab (xxx .com/?q=admin/reports/updates/list)

Then these two error messages pop-up. The thing is that I no longer have neither one installed.

Notice: Undefined index: zen in theme_update_report() (line 202 of .../modules/update/update.report.inc).
Backtrace:
theme_update_report(Array) theme.inc:1161 theme('update_report', Array) update.report.inc:17 update_status() module_filter.pages.inc:10 module_filter_update_status() call_user_func_array('module_filter_update_status', Array) menu.inc:517 menu_execute_active_handler() index.php:21

Notice: Undefined index: adaptivetheme in theme_update_report() (line 202 of .../modules/update/update.report.inc).
Backtrace:
theme_update_report(Array) theme.inc:1161 theme('update_report', Array) update.report.inc:17 update_status() module_filter.pages.inc:10 module_filter_update_status() call_user_func_array('module_filter_update_status', Array) menu.inc:517 menu_execute_active_handler() index.php:21

Kebz’s picture

Does anyone have a solution to get rid of this?

ERROR
Notice: Undefined index: adaptivetheme in theme_update_report() (line 202 of /homepages/30/d513154960/htdocs/OVLVX_com/BLove/modules/update/update.report.inc).

Backtrace:
theme_update_report(Array) theme.inc:1161
theme('update_report', Array) update.report.inc:17
update_status() module_filter.pages.inc:10
module_filter_update_status()
call_user_func_array('module_filter_update_status', Array) menu.inc:519
menu_execute_active_handler() index.php:21

kaicyee’s picture

So are we saying that this issue has not been resolved to date?

The last submitted patch, 61: 986888-61-available-updates-list.patch, failed testing.

  • catch committed 59bd679 on 8.3.x
    Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning...

  • catch committed 59bd679 on 8.3.x
    Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning...
mfuller526’s picture

@#17 - the patch needs to be placed in the module: core/modules/update. I know this by seeing component: update.module on this page, also reading code within the patch:

diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
index 2817c86..1fdd0b3 100644
--- a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php

However, patch #54 does not work with D7.51. The paths are incorrect/nonexistent.

[~/public_html/modules/update]$ patch -p1 < 986888-54-complete.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
|index 2817c86..1fdd0b3 100644
|--- a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
|+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
--------------------------
File to patch:   

Any solution ideas? Thanks.

deanflory’s picture

2017-01-21

Notice: Undefined index: adaptivetheme in theme_update_report() (line 202 of /.../modules/update/update.report.inc).

Drupal 7.53
Adaptivetheme 7.x-3.x-dev 2016-Dec-01

  • catch committed 59bd679 on 8.4.x
    Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning...

  • catch committed 59bd679 on 8.4.x
    Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning...
jday’s picture

Status: Needs review » Needs work

The last submitted patch, 85: 986888-85-availale-updates-d7.patch, failed testing.

maximpodorov’s picture

The patch in #85 doesn't work in my case:
disabled "seventeen" theme is the sub-theme of disabled "seven" theme.
I get "Notice: Undefined index: seven in theme_update_report() (line 202..."