Subs.Php Bug?

Started by Hj Ahmad Rasyid Hj Ismail, February 03, 2013, 09:51:37 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

This might not be a bug but I report it here anyway.

Quotehttp://anypost.qom.my/index.php?action=login2;sa=check;member=2650
8: Undefined index: title
File: /xxxxx/public_html/qom/Themes/SimpleRevamp2-130123/index.template.php
Line: 441

http://anypost.qom.my/index.php?action=login2;sa=check;member=2650
8: Undefined index: href
File: /xxxxx/public_html/qom/Themes/SimpleRevamp2-130123/index.template.php
Line: 440

There is nothing wrong with the said line as it is default. I reproduce here:
436: foreach ($context['menu_buttons'] as $act => $button)
437: {
438: echo '
439: <li id="button_', $act, '">
==>440: <a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
==>441: <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
442: </a>';


I'm not sure what's causing this error but when I did a search it leads me here: http://dev.simplemachines.org/mantis/view.php?id=3690

The relevant line in Subs.php would be:
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))

That is basically different that the suggested solution. Should I try the suggested solution? i.e. by changing the above to this:
elseif (($user_info['is_guest'] && $context['current_action'] == 'login2') || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))

(I think || is the priority and may be the extra () is not needed.)  I am not good (more like afraid) with source, that's why I asked.

Arantor

This doesn't happen on a fresh 2.0 install.

It is a badly written mod applying changes that aren't being checked for properly. Or the theme menu code isn't doing its job properly.
Holder of controversial views, all of which my own.


Hj Ahmad Rasyid Hj Ismail

I kinda disagree. In fact the forum was freshly reinstalled from 2.0.2 package. No changes to theme menu nor any heavy mods are being used. The only big ones are security fixes by 2.0.3 and 2.0.4 packages. Anyway, the suggested solution seems working. But since you are the expert, I will take your word and test this further using default theme later.

NanoSector

Does it happen with the default theme? Is there a button which is improperly coded in Subs.php? Got any mods installed?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Hj Ahmad Rasyid Hj Ismail

#4
I was correct. It is a bug. I have replaced the forum with the full 2.0.4 upgrade package and upgraded it just to be sure.  Default theme with no mods. And it just repeated.

Quotehttp://anypost.qom.my/index.php?action=login2;sa=check;member=123
8: Undefined index: title
File: /xxxxx/public_html/qom/Themes/default/index.template.php
Line: 422

http://anypost.qom.my/index.php?action=login2;sa=check;member=123
8: Undefined index: href
File: /xxxxx/public_html/qom/Themes/default/index.template.php
Line: 421

417: foreach ($context['menu_buttons'] as $act => $button)
418: {
419: echo '
420: <li id="button_', $act, '">
==>421: <a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
==>422: <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
423: </a>';


I also tested the suggestion and it fixed the bug again.

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Hj Ahmad Rasyid Hj Ismail

#6
That were all different from the OP and they had been resolved.

I did mention this above: http://dev.simplemachines.org/mantis/view.php?id=3690. And I also did mention that the suggestion given fixed the bug.

Of course, I rewrite a bit since the older line is not the same with the new one. It is not beautiful but it works . You can rewrite it better IMO.

emanuele

I may be sleepy but I'm not sure what's the point...
You reported a bug.
You reported a link to a bug report marked as fixed.
I showed you a link to another bug report (regarding exactly the same bug, first result of the search I posted) with a fix proposed by Kays (and implemented in 2.1).
The fix by Kays fixes also other similar issues in other places.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Hj Ahmad Rasyid Hj Ismail

Well, you are the coder. The reason I noted that they are different is because none of them relates to index.template.php except the one I found. Plus, I have said this in the OP: I am not good (more like afraid) with source, that's why I asked.

I have tested Kays suggestion and it also fixes the bug. I guess I will be relying on Kays' rather than my own finding especially since that has been accepted and implemented in 2.1.

A bug is a bug. It will bugger me or anybody using SMF unless it is fixed. And since Kays suggestion has been accepted, I hope that can be implemented in 2.0 as well.

By the way, go to sleep emanuale. You don't have to stay up late unless you really really have to. Good nite.

Advertisement: