Advertisement:

Author Topic: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)  (Read 10888 times)

Offline Ferny

  • Semi-Newbie
  • *
  • Posts: 40
  • Gender: Male
    • MundoDivX
Hello!

There is something wrong in the upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip). It's about the second operation in "$sourcedir/ManageServer.php" (also shown here):

Code: [Select]
<operation>
<search position="before"><![CDATA[
$context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);
]]></search>
<add><![CDATA[
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
]]></add>
</operation>

It should be position="replace" instead of position="before". I saw some errors in my forum log after upgrading, and after manual fixing as I describe below, they are gone.

The fact is, we have the following at line 1875 of ManageServer.php in SMF 2.0.8 install package:

Code: [Select]
$context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);
After patching to 2.0.9 as described above, we would have this:

Code: [Select]
$context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();

So the second unserialize() call returns an error, something like "string expected as parameter, but array found" (sorry I've fixed this in my forum already but I didn't copy the exact message), this is because the first unserialize() call has already done the job.

If you see ManageServer.php line 1875 in SMF 2.0.9 install package, you will see only this:

Code: [Select]
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
So it looks like the upgrade package is wrong, and the intention was to use position="replace" instead of position="before" for that particular change. That, for sure, would make the patch to 2.0.8 to be in line with 2.0.9 source.

Just to clarify: the ManageServer.php file is OK in the install and upgrade full packages for 2.0.9, just the upgrade package from 2.0.8 is wrong.

Regards :)

PS FYI: it's related to one custom mod that uses a "<select>" with multiple options in the Admin panel, that makes that part of SMF code to execute. In theory, you can reproduce the error by displaying any "<select>" with multiple options in the Admin panel (I don't know if SMF original source uses any, if not you can try any mod that uses it).
Digital Video & Audio:
www.mundodivx.com


Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,428
  • Gender: Male
    • Kindred-999 on GitHub
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #2 on: October 05, 2014, 09:07:45 PM »
Hmmm...  BK, why the link? Pall of the necessary information was listed here already.  Unneeded.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Burke ♞ Knight

  • SMF Hero
  • ******
  • Posts: 3,534
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #3 on: October 05, 2014, 09:10:48 PM »
Actually, I meant to link to the answer. This is what I should have linked to....lol

That should indeed be a replace. Just remove the original line and keep the new one there.

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,499
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #4 on: October 06, 2014, 09:11:03 AM »
Not knowing diddly about coding, which of these lines in ManageServer.php do I need to remove?

Code: [Select]
{
$context['config_vars'][$config_var[1]]['name'] .= '[]';
$context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);

$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
}
Online Manual

Please do not PM me for support.

Offline Burke ♞ Knight

  • SMF Hero
  • ******
  • Posts: 3,534
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #5 on: October 06, 2014, 10:32:34 AM »
Code: [Select]
$context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,499
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #6 on: October 06, 2014, 11:26:55 AM »
Thanks BK. :)
Online Manual

Please do not PM me for support.

Offline SabreOfParadise

  • Semi-Newbie
  • *
  • Posts: 98
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #7 on: October 07, 2014, 02:53:47 AM »
Has this been fixed in the package manager upgrade yet?

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #8 on: October 07, 2014, 03:01:10 AM »
No, and it won't be in this version. We need to release a next version patch to fix these issues. We can't have 2 different versions of the same...version :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline br360

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,398
    • GenXcommunity
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #9 on: October 07, 2014, 03:10:11 AM »
Ok, so dumb question; if we were to go ahead and manually fix any of the errors ourselves, won't that cause more errors when the next patch is released; as it would be looking for the fixes to this patch?

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #10 on: October 07, 2014, 03:19:27 AM »
It will allow it to be skipped ;)
If the error is there, fix it. If not, skip
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 503
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #11 on: October 07, 2014, 02:46:29 PM »
So, what should you do if you applied the patch before the bug was discovered? (I think I did it before the bug was discovered. D;)
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Ferny

  • Semi-Newbie
  • *
  • Posts: 40
  • Gender: Male
    • MundoDivX
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #12 on: October 07, 2014, 02:50:12 PM »
@NekoJonez

Search "unserialize" in the ManageServer.php
You will find something like this:

Quote
               $context['config_vars'][$config_var[1]]['name'] .= '[]';
               $context['config_vars'][$config_var[1]]['value'] = unserialize($context['config_vars'][$config_var[1]]['value']);

               $context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();

And remove the red line


By the way, the functional impact is very limited and in many cases it should not cause any issue:
- Only affects configuration options in the admin panel that are managed using a <select> with multiple options (I don't know if the default SMF installation uses that, but some Mods do...)
- The configuration in the <select> multiple, is saved correctly in the database, so it's correctly taken into account for the forum behavior.
- The configuration is not displayed after reloading the page in the Admin panel. So it's impossible to know the current configuration unless you fix this. This is the only impact that I noticed (appart from the errors appearing in the log)
« Last Edit: October 07, 2014, 03:00:30 PM by Ferny »
Digital Video & Audio:
www.mundodivx.com

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 503
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #13 on: October 07, 2014, 03:05:15 PM »
Thanks, the red line was indeed still there.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,428
  • Gender: Male
    • Kindred-999 on GitHub
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #14 on: October 07, 2014, 07:58:06 PM »
neko...   there was not update - so the line will be there for all versions of 2.0.9 made from the patch
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Oldcrow

  • Jr. Member
  • **
  • Posts: 323
  • Gender: Male
  • "One foot in the grave!"
    • Coffeetime Unlimited
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #15 on: October 08, 2014, 09:27:04 PM »
I tried two times to install from the ACP. I get the following error.

Code: [Select]
Code: (Find) [Select] * @version 2.0.8
Code: [Select]
Code: (Replace) [Select] * @version 2.0.9

Code: [Select]
Code: (Find) [Select] if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && strpos($db_string, 'INSERT INTO') === false)
Code: [Select]
Code: (Replace) [Select] if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && preg_match('~^\s+SELECT~i', $db_string))
Ideas?

Thanks

Ron..

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 503
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #16 on: October 09, 2014, 12:18:20 PM »
neko...   there was not update - so the line will be there for all versions of 2.0.9 made from the patch

Yay for derpiness.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline nivlac

  • Semi-Newbie
  • *
  • Posts: 59
  • Gender: Male
  • I started with nothing and have most of it left.
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #17 on: November 20, 2014, 12:07:11 AM »
I tried the patch using the Package Manager and got a "Test Failed" message on one file, .sources/display.php. In the "Replace" text on the failed line is says "Find:
Code: [Select]
$context['show_view_results_button'] = $context['allow_vote'] && (!$context['allow_poll_view'] || !$context['poll']['show_results'] || !$context['poll']['has_voted']);
"and "Replace:
Code: [Select]
$context['show_view_results_button'] = $context['allow_vote'] && $context['allow_poll_view'] && !$context['poll']['show_results'];
"The issue is the "Find" line is not there. There is a line that is almost exactly the same with the exception it has
Code: [Select]
['poll'] in front of each segment, as follows:
Code: [Select]
$context['poll']['show_view_results_button'] = $context['poll']['allow_vote'] && (!$context['poll']['allow_poll_view'] || !$context['poll']['show_results'] || !$context['poll']['has_voted']);
Should I go ahead and run the install and then manually remove the line with the "poll" references and replace it with the "Replace" line, or insert the "poll" bit in front of each segment in the replacement line?

I guess I should also say I have the mod Additional Polls installed. Could that be what placed the "poll" bits in the code?

Thanks...

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Bug in upgrade package from 2.0.8 to 2.0.9 (smf_patch_1.1.20_2.0.9.zip)
« Reply #18 on: November 20, 2014, 04:17:32 AM »
I will take a wild guess and say that you should install the patch ignoring that error.
The mod will probably not care about the changes introduced by the update patch, so... ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair