The documentation for hook_requirements http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct... pretty clearly states for the 'value' key in the returned array:
value: The current value (e.g., version, time, level, etc). During install phase, this should only be used for version numbers, do not set it if not applicable.
Well, I didn't set it because displaying the value I'm checking would be a security issue and now the status report page is throwing a notice at me so either the code or the documentation is wrong.
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 1880224-25.patch | 2.69 KB | joelpittet |
| #25 | 1880224-25-test-only-fail.patch | 1.91 KB | joelpittet |
| #25 | interdiff.txt | 858 bytes | joelpittet |
| #24 | drupal-fix-for-status-report-undefined-index-value-1880224-10363887-7.39.patch | 1.56 KB | monta |
| #9 | drupal-status_report_undefined_index_value-1880224-9.patch | 791 bytes | validoll |
Comments
Comment #1
thedavidmeister commentedPresuming the documentation outlines the intended behaviour, patch is attached.
Comment #2
thedavidmeister commentedHmm, just re-read the documentation and realised that it could mean that "'value' is only optional during the install phase", as well as "this is what it means during install and also it is optional".
The former interpretation still seems weird to me, that it would be optional for only one value of $phase ie. The value of the variable passed to the hook subtly modifies the required structure of the return value.
Weren't all those D6 $op style shenanigans weeded out in Drupal 7?
Comment #3
rooby commentedIt is valid to not have a value for 'value' (the docs even say do not set if not applicable), so I think it's existence should be checked first.
It is in other places like drupal_check_module().
Comment #4
thedavidmeister commentedso, RTBC?
Comment #5
rooby commentedYep. Solves the issue and applies cleanly.
Comment #6
rooby commentedOops, wrong version. Here is a drupal 8 one that is the same.
Comment #7
deanflory commentedApplied patch in #1 onto D7.23 and the error went away.
Comment #8
alexpottHmmm using a ternary operator here seems unnecessary bearing in mind http://fabien.potencier.org/article/48/the-php-ternary-operator-fast-or-not and we're just assigning the same value to itself which seems clunky.
How about we just change
to
Comment #9
validoll commentedIMHO this is small economy. With the first option code more readable.
At this time, right patch for 7.23
Comment #10
thedavidmeister commentedThanks for that, unfortunately bugs have to be fixed against latest version then backported.
Comment #11
arruk commentedI added this at like 2583 of system.admin.inc. There is a reason why this solution wont work? I mean besides the fact that is a core hack?
Comment #12
deanflory commentedCurrent error in Drupal 7.26:
HAPPY BELATED BIRTHDAY to this issue! ;)
I'll try applying #1 again and if it has issues I'll try #9. Not sure why there's another patch for the same version of Drupal (D.7.23).
Comment #13
deanflory commentedThe two patches on this issue have a variance where a line is commented or not.
1880224-fix-notice-for-missing-value-on-status-report-page-1.patch
drupal-status_report_undefined_index_value-1880224-9.patch
Which is correct?
The patch without commenting (//) works for D7.26.
Comment #14
validoll commentedOh, this is right, i'm not delete comment :(
Comment #15
deanflory commentedPatch in #1 works for D7.28 and has worked for almost a year and half but is still not committed to Drupal 7 as of D7.28.
Marking this as RTBC to get some attention since this is lingering.
I cannot verify whether the patch in #6 works for D8. Someone?
Comment #17
alexpottUsually we fix the latest dev version first however since #2151101: Convert theme_status_report() to Twig has converted theme_status_report() to twig we no longer have this problem since Twig handles the problem if
requirements.valuedoes not exist.But regardless of this version the patch is not rtbc since it has no test.
Comment #18
alexpottOh and the patch in #9 is not right - patch #1 would fix the issue for D7 - but to prove this you'll need a test.
Comment #19
bluecobalt commentedPatch in #1 works for Drupal 7.34.
Comment #20
capfive commented#1 fixed it here 7.34 build :)
Comment #23
Anonymous (not verified) commented#1 fixed it here 7.39
Comment #24
monta commentedI fixed it for 7.39
Comment #25
joelpittetRe-posting the previously RTBC'd #1. With a copy change on the comment. Hope that works well?
@alexpott, tried to make a test for this, but I'm shit at tests... so lmk how I can improve this?
Comment #27
joelpittetI'm setting this to RTBC because I didn't actually write the fix, I only changed the comment for clarity and wrote the test to prove it fixes the problem.
Comment #29
stefan.r commentedPatch looks good, thanks!
Comment #30
ashwinshPatch works for me, thank you..!
Comment #31
stefan.r commentedPer #17 this is not needed for D8, just want to double check with Fabianx whether we still want to address #8.
Comment #32
fabianx commentedRTBC + 1
Looks great to me, the ternary operator thing is not a problem for me and theme_status_report is not in the critical path at all ...
Comment #34
stefan.r commentedCommitted and pushed to 7.x, thanks!