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

dave reid’s picture

Title: notice: Undefined variable: potentially_inside_a_hook_menu » notice: Undefined variable

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

dave reid’s picture

Title: notice: Undefined variable » PHP notes and undefined variables oh my!
Status: Active » Needs review
Issue tags: +ironic
StatusFileSize
new1.94 KB

I think it is ironic that I am filing a patch for undefined variables for the coder tough love review module. :)

boombatower’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.55 KB

Re-rolled.

boombatower’s picture

Title: PHP notes and undefined variables oh my! » PHP notices and undefined variables oh my!
xjm’s picture

Status: Reviewed & tested by the community » Fixed

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

Status: Fixed » Closed (fixed)
Issue tags: -ironic

Automatically closed -- issue fixed for 2 weeks with no activity.