This module creates a function named "i18n_access_node_access", which is intended to be a menu access callback. Unfortunately this function also accidentally implements hook_node_access(), causing it to be called every time any node is viewed (such as from the default "node" front page). Right now it just throws a harmless PHP Notice about missing arguments, but could potentially cause all kinds of weirdness if it were updated in the future.

This patch renames the function from "i18n_access_node_access" to just "i18n_access_node". Don't worry there's no hook_node(), even in Drupal 7. :-)

Comments

quicksketch’s picture

StatusFileSize
new2.22 KB

Sorry that patch also has a separate notice fix in it, which I'll file separately. Here we are.

quicksketch’s picture

StatusFileSize
new3.22 KB

I ran across a similar module the other day and it prevented this problem simply prefixing the function with "_". Seems like a good approach to me, so here's an alternative patch to #1, just putting an underscore in front of the function name.

quicksketch’s picture

StatusFileSize
new2.19 KB

Heh, dang, included the notice fixes again. Same patch as #2 with only relevant changes.

toemaz’s picture

Status: Needs review » Needs work

Applied to 6.x-1.x-dev.

Question: for developers already using this module, do they need to empty cache so the menu is rebuild? If so, how do we trigger this when they update the module?

quicksketch’s picture

I don't think that this accidental implementation of hook_node_access() actually caused much harm, since it always bailed out pretty quickly and didn't return anything. However if you'd like to force a cache clear you can make an update hook that doesn't contain anything other than drupal_flush_all_caches();

yang_yi_cn’s picture

Status: Needs work » Fixed

committed, with drupal_flush_all_caches() in .install file.

Status: Fixed » Closed (fixed)

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