Coder review - undefined index if module does not have hook_menu()
Dave Reid - November 29, 2008 - 21:15
| Project: | Translation template extractor |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If I'm running the potx coder review on a module that does not implement hook_menu, I get the following PHP notice error:
notice: Undefined index: statistics_advanced_menu in /home/davereid/Projects/drupal6/sites/all/modules/contrib/potx/potx.inc on line 894.
<?php
function _potx_find_menu_hook($file, $filebase, $save_callback) {
global $_potx_tokens, $_potx_lookup;
if (is_array($_potx_lookup[$filebase .'_menu'])) {
?>Needs to be changed to:
<?php
function _potx_find_menu_hook($file, $filebase, $save_callback) {
global $_potx_tokens, $_potx_lookup;
if (isset($_potx_lookup[$filebase .'_menu']) && is_array($_potx_lookup[$filebase .'_menu'])) {
?>and it fixes all the notice errors!

#1
Yes, looks like a great fix.
#2
Committed this fix, thanks! Also target for 5.x-2.x backport, if that ever happens. Not high on priority.
#3
Since 5.x is not maintained, moving back to fixed.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.