Validate path before loading node from arg(1)

Bug #444914 reported by Pierre Buyle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UD Header
Fix Released
Undecided
Unassigned

Bug Description

In udheader_build_block, a node is loaded with node_load(arg(1)). arg(0) and arg(1) should be validated to avoid loading node when not required.

if(arg(0) == 'node' && ($nid = arg(1)) && is_numeric($nid) && ($node = node_load($nid))) {
  //Ok, we have a node
} else {
  //Use udheader_default
}

Related branches

Revision history for this message
Michael Lustfield (michaellustfield) wrote :

Could you please tell me where this should be used? I'm not sure where the block shouldn't be shown.

Changed in ubuntu-drupal-header:
status: New → Incomplete
Revision history for this message
Pierre Buyle (mongolito404) wrote :

See r23 in my branch

Revision history for this message
Pierre Buyle (mongolito404) wrote :

I should test my patch, even simple one. The second test is wrong and a ';' is missing in r23. It's fixed in r24.

In r24, I also moved rendering into a dedicated theme function. It allows theme overriding of the header markup. I don't need it now but it is a good practice in the Drupal world.

Changed in ubuntu-drupal-header:
status: Incomplete → In Progress
Revision history for this message
Michael Lustfield (michaellustfield) wrote :

I needed to remove the "dedicated theme function" to make the module work after the merge. I will try to figure out why this isn't working.

Revision history for this message
Michael Lustfield (michaellustfield) wrote :

I finished working on this in r25. Part of the issue was theme registry.

Changed in ubuntu-drupal-header:
status: In Progress → Fix Committed
Revision history for this message
Michael Lustfield (michaellustfield) wrote :

This fix has been merged into drupal.org.

Changed in ubuntu-drupal-header:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.