Notice: Undefined variable: selectivizr in mothership_preprocess() on line 516 of mothership/template.php

I get this notice from time to time, especially on error pages :) (after a different problem throws an exception).

Comments

mojzis’s picture

StatusFileSize
new5.47 KB

defining selectivizr. not sure about performance, though.

mojzis’s picture

Status: Active » Needs review

sorry about all the extra lines - there were some extra whitespaces that my proactive editor removed :)

the_g_bomb’s picture

Patch applies cleanly and removes the error message from what I can tell. Haven't tested much further than that though.

Funksmaname’s picture

hey, this patch changed the error line number (66), but I still get errors... any ideas??
in fact, it's made the error appear 13 times repeated, instead of once...

mortendk’s picture

Status: Needs review » Closed (cannot reproduce)

hmm cant reproduce this

p0pemar1naru’s picture

It's under hook_preprocess, attached to hook "maintenance_page" #521. The var is indeed uninitialized. Even my Netbeans editor complained about it when I opened the file :(
PHP will throw this NOTICE only when Maintenance mode is active.

The most non-intrusive fix that I can think of: $vars['selectivizr'] = @$selectivizr; OR @$vars['selectivizr'] = $selectivizr;
Add the @ in front of the var declaration at line #521.

Instead of declaring the var, I would just say ignore the Notice. Most probably the theme devs will declare it on the new version, so this hotfix won't affect the overall theme code in any way.

rooby’s picture

Version: 7.x-2.8 » 7.x-2.10
Issue summary: View changes
Status: Closed (cannot reproduce) » Active

This is still a problem.

rooby’s picture

Status: Active » Needs work

Current patch is full of unrelated changes.

rooby’s picture

Version: 7.x-2.10 » 7.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new2.35 KB

Here is a patch for latest dev.

The approach is a bit different to the previous one to remove the reference to a never used variable and not run selectivizr related code for template files that are unrelated to it.

rooby’s picture

StatusFileSize
new2.35 KB

Actually I may as well fix whitespace errors and duplicate semicolons in the code block that was moved.

mparker17’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good.

Works for me!

cinnamon’s picture

I second that, it fixes the notice and also applies just fine on current release.

  • realityloop committed 468d922 on 7.x-3.x
    #1851564 by rooby, realityloop: Undefined variable selectivizr
    

  • realityloop committed cd6a5b8 on 7.x-2.x
    #1851564 by rooby: Undefined variable selectivizr
    
realityloop’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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