News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Undefined Error

Started by Drover, April 12, 2012, 11:39:31 AM

Previous topic - Next topic

Drover

I'm getting this error:

8: Undefined variable: disable_unhideafter
in Line 1405 of Sources/Display.php


Line 1403 // Second Option for unhide content, for special hide tag
Line 1404 if ($disable_unhideafter)
Line 1405 $context['user_post_avaible'] = 0;

Kindred

looks like you installed a mod which is not properly defining its variables...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Suki

Looks like a var added by a mod,  I guest the mod author wanted to check for a boolean or simply 1 or 0, checking for the var itself will generate that error, however if you check with an isset() or !empty()  then it will not generate the error.

By checking for the var itself the var must exists, it $disable_unhideafter = null;   if you check with an iset() or empty()  the var doesn't  necessary need to exists since the check itself if for existence,  a var can exists and still be null.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Drover

Quotelooks like you installed a mod which is not properly defining its variables...

That's what it looked like to me too. Is there any way to figure out what mod or what the correct variable is?

QuoteLooks like a var added by a mod,  I guest the mod author wanted to check for a boolean or simply 1 or 0, checking for the var itself will generate that error, however if you check with an isset() or !empty()  then it will not generate the error.

By checking for the var itself the var must exists, it $disable_unhideafter = null;   if you check with an iset() or empty()  the var doesn't  necessary need to exists since the check itself if for existence,  a var can exists and still be null.

I have no idea what this means.  What is an isset() or an empty() and how does that help me fix this problem?  What exactly do I need to do?

MrPhil

The first question to ask would be, "Did the mod say that it installed correctly, or were there errors reported?" If the mod was then uninstalled, "Did the mod say that it uninstalled correctly, or were there errors reported?" In either case, you could have ended up with a partial installation that used to (or should have) added code to define the variable, and now doesn't.

Suki

Quote from: Drover on April 12, 2012, 11:53:50 AM
Quotelooks like you installed a mod which is not properly defining its variables...

That's what it looked like to me too. Is there any way to figure out what mod or what the correct variable is?

QuoteLooks like a var added by a mod,  I guest the mod author wanted to check for a boolean or simply 1 or 0, checking for the var itself will generate that error, however if you check with an isset() or !empty()  then it will not generate the error.

By checking for the var itself the var must exists, it $disable_unhideafter = null;   if you check with an iset() or empty()  the var doesn't  necessary need to exists since the check itself if for existence,  a var can exists and still be null.

I have no idea what this means.  What is an isset() or an empty() and how does that help me fix this problem?  What exactly do I need to do?


What I mean is that is a common error to define vars on a conditional,  meaning there is always a chance that the var won't get defined, thus the error appear.

But it depends if the mod was successfully installed like MrPhil suggest.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Drover

Quote from: MrPhil on April 12, 2012, 11:54:15 AM
The first question to ask would be, "Did the mod say that it installed correctly, or were there errors reported?" If the mod was then uninstalled, "Did the mod say that it uninstalled correctly, or were there errors reported?" In either case, you could have ended up with a partial installation that used to (or should have) added code to define the variable, and now doesn't.

As I said before, I don't know what mod may have done this, but no I don't have any mods running that gave errors.

Suki

Guessing by the var name I would dare to say is something related to a "hide mod"  "hide something mod"

Do you have any mod that resembles those words?


Edit, oh, after checking the first bit of code:

// Second Option for unhide content, for special hide tag


Looks like Hide Tag Special mod.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Drover

Where are these variables defined? So I can look and see if there is a something similar that's just not exactly correct in line 1405?

Drover

Quote from: Suki on April 12, 2012, 12:03:10 PM
Guessing by the var name I would dare to say is something related to a "hide mod"  "hide something mod"

Do you have any mod that resembles those words?

I was looking for something like that too, but nothing that looks like it.


QuoteEdit, oh, after checking the first bit of code:

// Second Option for unhide content, for special hide tag


Looks like Hide Tag Special mod.

Yeah, I searched the forum and found that too before posting this. But no, I don't have that mod installed and never did.  It occurred that the same mod author might use similar code on multiple mods (does that make sense?), but I actually have a few mods from the ADK team. 

Thank-o-matic
Show your social networks
Redirect Error 404
Enhanced About Page

How would I check this?

Suki

perhaps is this one Thank-o-matic since it is compatible with the hide tag mod last time I checked.

If that is the case then it falls back to a mistake in the code rather than a true error,  the mod author is checking if the hide tag mod is installed and doing the check on the var itself is what is causing the error since that var will never exists because you don't have that mod installed.


Attach your Sources/Display.php file here to take a look.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Drover

Ah I see.  That makes sense.  Thanks.

Suki

OK, use this one, I changed

if ($disable_unhideafter)

with

if (isset($disable_unhideafter))

To perform the check on the existence of the var, avoiding errors.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

MrPhil

How did that one get through the vetting: improperly checking if another mod is installed? Anyway, someone please notify the mod author and get them to update their code!

Drover

Much Grass, Suki!  Looks like that fixed it!

Suki

Quote from: MrPhil on April 12, 2012, 04:18:35 PM
How did that one get through the vetting: improperly checking if another mod is installed? Anyway, someone please notify the mod author and get them to update their code!

It's easy, if that code wasn't there when the mod was reviewed then there is no way we could detect it.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Advertisement: