Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I enabled the latest chaos tools release on D7, and I get a a notice on every page load.
The reason is that if $info['function'] refers to a non-existing function name, then the $output variable won't be defined at all. I created a little patch which provides a fix to the problem.
Comment | File | Size | Author |
---|---|---|---|
#4 | undef_output_in_theme_2.patch | 541 bytes | tamasd |
undef_output_in_theme.patch | 388 bytes | tamasd | |
Comments
Comment #1
tamasd CreditAttribution: tamasd commentedOops, I set the wrong version.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedNot sure what to do with this. I'm not very fond of silently ignoring issues.
Comment #3
Nick Lewis CreditAttribution: Nick Lewis commentedDoesn't seem critical. I little confused, if the theme function doesn't exist, wouldn't it cause a fatal error? My guess is that for one reason another the ctools function isn't returning output like its supposed to. Mind telling us what function its calling? Also, while setting $output = ''; will solve the notice, the a is whether perhaps its useful to have a notice display when a theme function is returning no output?
IF the answer is no then, clearly we'd want to initialize $output a little higher (line 863 theme.inc) too:
Comment #4
tamasd CreditAttribution: tamasd commentedThe problem is that it causes a bit confusing error message.
Maybe it can be better if the theme function outputs a proper error message?
With this patch, the error message looks like this:
Comment #5
effulgentsia CreditAttribution: effulgentsia commentedSame basic thoughts are on #674108: ThemeManager::theme() does not trigger an error when a theme hook is not found, but there's still an open question on that issue as to what to do besides throw an error. Please help out on that one. Thanks!