When running the Coder Tough Love review, I get the following notices:
# notice: Undefined variable: potentially_inside_a_hook_menu in /home/davereid/Projects/drupal6/sites/all/modules/contrib/coder_tough_love/coder_tough_love.module on line 171.
# notice: Undefined variable: potentially_inside_a_hook_menu in /home/davereid/Projects/drupal6/sites/all/modules/contrib/coder_tough_love/coder_tough_love.module on line 176.
# notice: Undefined variable: potentially_inside_a_hook_menu in /home/davereid/Projects/drupal6/sites/all/modules/contrib/coder_tough_love/coder_tough_love.module on line 183.
function _coder_tough_love_admin_menu_descriptions(&$coder_args, $review, $rule, $lines, &$results) {
foreach ($lines as $line_number => $line) {
$line = implode(' ', $line); // concat'd parts.
...
// if we're inside, look at the line and check for an admin path.
if ($potentially_inside_a_hook_menu && preg_match('/\[[\'"]admin\//', $line)) {
$potentially_found_an_admin_path = $line_number; // used in the error.
}
Should be changed to:
function _coder_tough_love_admin_menu_descriptions(&$coder_args, $review, $rule, $lines, &$results) {
foreach ($lines as $line_number => $line) {
$line = implode(' ', $line); // concat'd parts.
$potentially_inside_a_hook_menu = 0;
...
// if we're inside, look at the line and check for an admin path.
if ($potentially_inside_a_hook_menu && preg_match('/\[[\'"]admin\//', $line)) {
$potentially_found_an_admin_path = $line_number; // used in the error.
}
Comments
Comment #1
dave reidNow I'm also getting:
* notice: Undefined variable: potentially_found_an_admin_path in /home/davereid/Projects/drupal6/sites/all/modules/contrib/coder_tough_love/coder_tough_love.module on line 177.
* notice: Undefined variable: potentially_found_an_admin_path in /home/davereid/Projects/drupal6/sites/all/modules/contrib/coder_tough_love/coder_tough_love.module on line 184.
$potentially_found_an_admin_path = 0;should also be added along with$potentially_inside_a_hook_menu = 0;.Comment #2
dave reidI think it is ironic that I am filing a patch for undefined variables for the coder tough love review module. :)
Comment #3
boombatower commentedRe-rolled.
Comment #4
boombatower commentedComment #5
xjmThanks, this seems like the proper way to resolve this to me. Committed to 6.x-1.x-dev:
http://drupal.org/commitlog/commit/7948/78dc17a3be3b5b6ad8d501e0a9e2fd2b...