News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Undefined index in load.php randomly

Started by Ninja ZX-10RR, September 16, 2014, 12:32:57 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Quote from: ♦ Ninja ZX-10RR ♦ on September 17, 2014, 01:40:07 AM
You are only wrong when you say that I am not interested into it

Unless it is clearly stated in my posts, I denied claiming as such. :P

By the way, if it is a bug, I guess Arantor as SMF Friends can re-suggest it to the Team. They'll take his words. ;)

Arantor

Did we skip the part where 2.1 already includes me having already fixed this bug?

Hj Ahmad Rasyid Hj Ismail

You didn't say it is a bug in SMF 2.0. You said you cannot nail it down i.e. you do not the cause. You did suggest this to be put in the distribution base though and you did mention this already ends up in 2.1 as per your commit. May be I just read your posts literally and not laterally and that's why I was trying to look for the cause. I like it when I am doing that because that way, I'll learn more. No offence at all.

Ninja ZX-10RR

Quote from: ahrasis on September 17, 2014, 10:43:59 PM
Quote from: ♦ Ninja ZX-10RR ♦ on September 17, 2014, 01:40:07 AM
You are only wrong when you say that I am not interested into it
Unless it is clearly stated in my posts, I denied claiming as such. :P
Quote from: ahrasis on September 17, 2014, 01:31:25 AM
You stated that it starts by "removing an uninstalled package from mods list and this time was accessing mods settings, but it happened with more things", so IMO something that was changed definitely is causing this error. Since you firstly posted this as a bug, I am more interested in finding the real cause of the problem.

But I guess that it is not urgent nor important to you anymore. Sorry, if I did bother you with suggestions to find its real cause and proper solution as I was thinking you were interested in it. Anyway, so long that permanently fixed what is broken and you are happy with it, I guess it should be fine.

Again, I could be wrong. ;)
...You did say that.
And you did miss also this
Quote from: Arantor on September 17, 2014, 06:35:10 AM
It is more likely an SMF bug than anything else.

I think we can consider this as solved and hopefully by 2.10 having a patch for it? I am not experiencing the issue anymore so I think that Arantor fixed it :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Kindred

Meh... Probably not going. To be fixed in 2.0.x, given the release of 2.0.9 and the soon to be beta of 2.1
Сл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."

Ninja ZX-10RR

Wait. Will the development for 2.0.x stop after the release of 2.1? It sounded like that :/
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Kindred

With the exception of security releases, yes.   The same way development on 1.1.x stopped when 2.0 was released
Сл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."

Ninja ZX-10RR

That's not good news to me but thank you for telling me that, I couldn't have known it since I wasn't here when 1.1.x stopped ;) well then I will just keep the hotfix from Arantor and thank everybody as always :D
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

That concludes it.

By the way, Ninja, just for the sake of "chatting" with you, please read the whole sentence. You are not interested in it "anymore" is what I clearly mean. And I already noted that Arantor said "it is more likely".

I personally reckon the whole code that relates to it are to be examined not just the particular line in Load.php, as for me, they are related to each other. But I shouldn't be saying that as I know nothing about coding SMF anyway. Well, anyway, the rule says, don't fix it until it is broken. :P

Cheers!

Arantor

To be explained... the codebase of SMF is sufficiently complicated it is not always possible to pin down an actual cause to a bug.

We're talking about a bug that manifests itself very sporadically, without any ability to consistently reproduce. In a code base where parts of it have NPath complexities in the obscene proportions: 'good style' guides recommend you keep method NPath complexity under 200; I've been known to have routines into the billions, SMF has routines whose complexity is a 40+ digit number, it's simply impossible to be able to handle every possible permutation of operations of the base software.

If anyone could do that, it would probably be me, and I can't. All I can do is observe a fault condition and apply a preventative measure to prevent it from being an actual problem. I have not been able to reliably identify the situation which causes it. Doesn't mean it can't be done, nor necessarily does it mean it's worth my time to do, because in all honesty it isn't.

Ninja ZX-10RR

That's an explanation :O thanks as always :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Hj Ahmad Rasyid Hj Ismail

Thank you for your explanation and time in explaining the situation. I understand that we are all volunteers and doing things only within our limited available time. I really appreciate all your helps, guides and contributions to SMF whether it relates to me or not.

But actually I do have final question with regards to your solution. If the problem truly and correctly lies in $settings['actual_theme_dir'], how will it be considered empty or otherwise, before it is included as part of $language_directories? It is already ignored while it is not empty or not supposed to be empty, thus, creates undefined index.

Please explain further, if my question does make any sense to you or anybody.

Arantor

Quotef the problem truly and correctly lies in $settings['actual_theme_dir'], how will it be considered empty or otherwise,

That's just it.

It shouldn't be empty. It should always be declared. And for some random reason it ends up not being declared while still making it to that code.

And when it is not declared, it ends up throwing an error.

Hj Ahmad Rasyid Hj Ismail

So the code check the $settings['actual_theme_dir'] before adding it as part of $language_directories just to make sure it is not empty. But what if it still treat it as empty while it is not. What happen to the actual theme directory if it is actually there and it is not loaded because $settings['actual_theme_dir'] is ignored and treat as empty?

Though I would agree that it is good to add this in the SMF base distribution and fix, I want to be really clear on this. For the time being I am still thinking that it can't be SMF fault / bug unless everybody get this random error once in a while just running plain / vanilla SMF.

Based on the explanation, clearly something must have forced it to run first before its proper declaration that caused it to end up throwing that undefined index error.

So sorry if I do not make any sense to you or anybody.

Arantor

Yes, the change I outlined simply checks it exists before it tries to use it, straight up defensive programming.

If the actual theme directory is there, then it gets used exactly as it should be. If it is not, no harm, no foul and it doesn't matter.

Again, this has already been added in the 2.1 base distribution and comes up sporadically enough that it doesn't 'need' fixing in 2.0 because the rare times it does come up, I've documented how to fix it enough that it's really not a problem.

QuoteFor the time being I am still thinking that it can't be SMF fault / bug unless everybody get this random error once in a while just running plain / vanilla SMF.

Based on the explanation, clearly something must have forced it to run first before its proper declaration that caused it to end up throwing that undefined index error.

So sorry if I do not make any sense to you or anybody.

Based on the explanation, you missed the key points I've already outlined.

Hj Ahmad Rasyid Hj Ismail

Ok. SMF coding is complex. Please ignore what I said about that in the last part.

Quote from: Arantor on September 18, 2014, 12:37:10 PM
Yes, the change I outlined simply checks it exists before it tries to use it, straight up defensive programming.

If the actual theme directory is there, then it gets used exactly as it should be. If it is not, no harm, no foul and it doesn't matter.
I understand it won't produce any of that random undefined index if we used this fixed. But I also understand that some theme do rely on its own languages.

So I need to confirm whether can we really safely conclude there will be no harm, no foul and it doesn't matter even if there is actually another actual theme directory that is being used but it is considered as empty (as the check might fail the same as it failed earlier to detect even it is not empty)?

If that is so, it is fine with me. I just want to be clear on this. That's all.

Arantor

QuoteI understand it won't produce any of that random undefined index if we used this fixed. But I also understand that some theme do rely on its own languages.

And none of that is actually relevant.

If the folder isn't even defined, there's no possible way it can be used in the first place...

Hj Ahmad Rasyid Hj Ismail

Exactly my point. If I am in another theme that relies on its languages, and its language folder isn't even defined, won't that cause any undefined error?

Arantor


Hj Ahmad Rasyid Hj Ismail

I didn't mean to argue but may be I just don't understand or I don't make any sense. So, please just ignore my posts. Sorry for taking your time.

Advertisement: