Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: jamesbond007 on June 03, 2020, 12:06:53 PM

Title: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: jamesbond007 on June 03, 2020, 12:06:53 PM
Hi, for the first time I'm trying to do an update, in this case from SMF 2.0.15 to 2.0.16 (and in the next step I would like to go to 2.0.17). I am following the "Patching" instructions on this page: https://wiki.simplemachines.org/smf/Patching

After clicking the link that takes me to the package manager, I get the following errors:

Screenshot #1 (https://iili.io/JOOEzX.png)
Screenshot #2 (https://iili.io/JOOGXn.png)

The following mods are installed on my installation:
See also screenshot #3: https://iili.io/JOejCg.png

The two files with the conflicts (QueryString.php and Subs.php) will be found as attachments to this post.

I would be glad if anyone could help me out and point out what to do to update my installation to 2.0.16 (and then to 2.0.17).

Thanks in advance & kind regards,
jamesbond007.
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: jamesbond007 on June 03, 2020, 12:22:31 PM
Here are the details for the three failed tests:

The first one refers to the file ./Sources/QueryString.php:

Search:
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"~', 'pathinfo_insert__preg_callback', $buffer);
}


Insert after:

// Be nice and try to inject session tokens into login forms since many older themes don't.
if ($user_info['is_guest'])
$buffer = preg_replace_callback(
'~(<form[^<]+action=login2(.+))</form>~iUs' . (!empty($context['utf8']) ? 'u' : ''),
function ($m) use ($context)
{
$repl = '';
if (strpos($m[0], $context['session_var']) === false)
$repl .= '<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"/>';

return $m[1] . $repl . '</form>';
},
$buffer
);


The second one refers to the file ./Sources/Subs.php:

Search:
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},


Replace:
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

$data = get_proxied_url($data);
},


The third one also refers to the file ./Sources/Subs.php:

Search:
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},


Replace:
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

$data = get_proxied_url($data);
},
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: Horme Gaming on June 04, 2020, 05:19:33 AM
Here you go,  issue was one of your mods nCode Image Resizer modified the code that was being searched for, best advice for future is if you are getting errors uninstall the mods then try as usually is a mod causing the issue :)
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: jamesbond007 on June 04, 2020, 09:07:14 AM
Hi Deaks, thank you very much for your answer. I understand that I should uninstall the mod "nCode Image Resizer" and then the update should work without any issues, which I will try shortly.

Can I install this same mod again after having updated to 2.0.17?
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: Horme Gaming on June 04, 2020, 10:41:29 AM
yes :)

Also a good idea when you upgrade that you have the most uptodate versions of the mods installed as well.
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: jamesbond007 on June 05, 2020, 06:03:21 AM
I uninstalled the mod "nCode Image Resizer" and tried to run the update to 2.0.16 again.

Result:
So the question remains: How do I get rid of the first failed test refering to the file ./Sources/QueryString.php? Do I have to uninstall more mods? And if yes: Which ones?
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: Horme Gaming on June 05, 2020, 06:49:13 AM
if you only have those 4 mods then I would uninstall those 4 mods, all them will work on SMF 2.0.17 you will just need to install 2.0a of nCode Image Resizer.

Their is a more extreme route that we can try if you are up for it.
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: Doug Heffernan on June 05, 2020, 08:07:25 AM
Quote from: jamesbond007 on June 05, 2020, 06:03:21 AM
I uninstalled the mod "nCode Image Resizer" and tried to run the update to 2.0.16 again.

Result:

  • The first failed test is still there.
  • The second and the third failed tests have disappeared.
So the question remains: How do I get rid of the first failed test refering to the file ./Sources/QueryString.php? Do I have to uninstall more mods? And if yes: Which ones?

You can add the code manually for the failed file. However, the best way imo would be to overwrite all your forum files with the files from the large 2.0.17 large upgrade package.

Like that all your mods will be uninstalled, but you can re install them later. Another thing to keep in mind is if you have done manual edits to the files, make a note of them as they will be gone too. You can readd them too afterwards.
Title: Re: Failed tests when trying to update from 2.0.15 to 2.0.16
Post by: jamesbond007 on June 05, 2020, 09:50:10 AM
Thanks very much for you help, Deaks and doug_ips.

I proceeded like Deaks suggested and uninstalled my remaining three mods. (Originally I was reluctant to uninstall SimplePortal, but as all its data is stored in database tables, this seems to be safe.)

After that updating SMF to 2.0.16 and 2.0.17 worked without any issues. Next I checked for the latest version of every mod and installed them again. This also worked out as expected and without any problems.

Thanks again - topic is solved!

(Marked this thread as solved.)