Advertisement:

Author Topic: upgrade 2.0.15 --> 2.0.16 fail  (Read 845 times)

Offline AlanDewey

  • Semi-Newbie
  • *
  • Posts: 60
    • CCS Forum
upgrade 2.0.15 --> 2.0.16 fail
« on: December 28, 2019, 09:48:58 AM »
bit of a noooob here....


SMF 2.0.15
PHP 7.1.26

get this failure notice

Code: [Select]
* 37. Execute Modification .\Sources/Post.php Test successful
* 38. Execute Modification .\Sources/Profile-Modify.php Test failed
1. Replace .\Sources/Profile-Modify.php Test successful
2. Add After .\Sources/Profile-Modify.php Test successful
3. Replace .\Sources/Profile-Modify.php Test successful
4. Add After .\Sources/Profile-Modify.php Test successful
5. Add Before .\Sources/Profile-Modify.php Test successful
6. Replace .\Sources/Profile-Modify.php Test failed
* 39. Execute Modification .\Sources/Profile.php Test successful


I discovered that    profile-modify.php~      was read-only.   I fixed that, now all permissions,  ran install again, but get identical error.

I thank everyone in advance for your generous assistance.

Offline m4z

  • Localizer
  • Sr. Member
  • *
  • Posts: 803
  • /mɛs/
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #1 on: December 28, 2019, 10:41:36 AM »
I discovered that    profile-modify.php~      was read-only.   I fixed that, now all permissions,  ran install again, but get identical error.

Files ending with a tilde are just backup files, I assume this doesn't cause your problem.
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline m4z

  • Localizer
  • Sr. Member
  • *
  • Posts: 803
  • /mɛs/
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #2 on: December 28, 2019, 10:44:43 AM »
get this failure notice

Code: [Select]
* 37. Execute Modification .\Sources/Post.php Test successful
* 38. Execute Modification .\Sources/Profile-Modify.php Test failed
1. Replace .\Sources/Profile-Modify.php Test successful
2. Add After .\Sources/Profile-Modify.php Test successful
3. Replace .\Sources/Profile-Modify.php Test successful
4. Add After .\Sources/Profile-Modify.php Test successful
5. Add Before .\Sources/Profile-Modify.php Test successful
6. Replace .\Sources/Profile-Modify.php Test failed
* 39. Execute Modification .\Sources/Profile.php Test successful

Are you using any mod packages?
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline Rob Lightbody

  • Charter Member
  • Jr. Member
  • *
  • Posts: 168
  • Gender: Male
  • Rob Lightbody, QE2 Story Forum administrator
    • The QE2 Story
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #3 on: December 28, 2019, 11:04:03 AM »
Hi there,

I am less of a newbie, but am getting the same error - everything tests OK, except this one file.

Its the last bit - the replace.

Code: [Select]
$sizes = @getimagesize($_FILES['attachment']['tmp_name']);

// No size, then it's probably not a valid pic.
// No size, then it's probably not a valid pic.
$mime_valid = check_mime_type($_FILES['attachment']['tmp_name'], 'image/', true);
$sizes = empty($mime_valid) ? false : @getimagesize($_FILES['attachment']['tmp_name']);

// No size, then it's probably not a valid pic.

I've attached my copy of it in the hope someone can help me.

I've got lots of mods, but I'd suspect "Automatic Attachment Rotation (and Resize)" could be the culprit... or possibly "Image Processing Memory Limit" ?

Offline AlanDewey

  • Semi-Newbie
  • *
  • Posts: 60
    • CCS Forum
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #4 on: December 28, 2019, 11:10:08 AM »
Mods:  yes       SMF ads

I had suspected that it failed to make the 'new' backup file  Profile-Modify.php~   because the existing one was read-only.  So I thought it 'passed' modifying Profile-Modify.php  but could not make the backup when it got to step 6   Replace.   

But now I see that line 1 and 3 "replace" were successful.  Did not notice that earlier.   (remember I am noob.)

I checked the timestamps on the files and none have today's date.  I do not understand the process where SMF "tests" these things without actually doing them.

Attached my profile-modify.php from 2017.     

I see that in mine, and in QE2,  profile-modify.php it states version 2.0.14  -   relevant?

Offline Rob Lightbody

  • Charter Member
  • Jr. Member
  • *
  • Posts: 168
  • Gender: Male
  • Rob Lightbody, QE2 Story Forum administrator
    • The QE2 Story
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #5 on: December 28, 2019, 11:18:40 AM »
I do not understand the process where SMF "tests" these things without actually doing them.


It does a "find" for an exact string, so it can find the right bit of code to change.  This will "fail" if it can't find the exact string.

This can happen because a mod has changed it.  I've often had to go in and put the code back to how it expects it to be, before I can do what I'm trying to do.

Its not just upgrades - installing (or uninstalling) a mod can hit the same snag.

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,711
    • sbulen on GitHub
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #6 on: December 28, 2019, 02:06:00 PM »
Let's start with QE2... 

~Line 2688, your file has:
Code: [Select]
$sizes = @getimagesize($_FILES['attachment']['tmp_name']);

// No size, then it's probably not a valid pic.
if ($sizes === false)

Vanilla 2.0.15 has an odd quirk where a comment is repeated:
Code: [Select]
$sizes = @getimagesize($_FILES['attachment']['tmp_name']);

// No size, then it's probably not a valid pic.
// No size, then it's probably not a valid pic.
if ($sizes === false)

You want to match the 2.0.15 code for the search/replace to work.  I would make your version match 2.0.15 by repeating the comment & try again.

Looks like that duplicate comment bugged someone so they deleted it...  The 2.0.16 patch gets rid of it...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline t-geronimo

  • Newbie
  • *
  • Posts: 6
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #7 on: December 29, 2019, 05:06:23 AM »
Many thanks, shawnb61! That fixed my first issue.

Sadly I have another one, "./Sources/QueryString.php" also failed:

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

Code: [Select]
[replace]
// 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
);

Since I run 2.0.15, my "QueryString.php" is still given with 2.0.9.
Shall I just manually replace the file after running the auto update or shall another method be prefered?

Many thanks for your support!

Offline Rob Lightbody

  • Charter Member
  • Jr. Member
  • *
  • Posts: 168
  • Gender: Male
  • Rob Lightbody, QE2 Story Forum administrator
    • The QE2 Story
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #8 on: December 29, 2019, 08:54:41 AM »
I'm all sorted now, thanks for your help on this!

Offline AlanDewey

  • Semi-Newbie
  • *
  • Posts: 60
    • CCS Forum
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #9 on: December 29, 2019, 09:04:47 AM »
for other noobs,

here is a    Review & Summary    of this fix   ( ShawnB61 was correct and helpful... I just had to 'sleep on it' one night and this morning it made sense to this noob.   (This is the first time I ever upgraded.))

find   Profile-Modify.php  in the /sources directory

fine the line   
Quote
// No size, then it's probably not a valid pic.   
   and then   ADD THE EXTRA COMMENT !

Code: [Select]
$sizes = @getimagesize($_FILES['attachment']['tmp_name']);

// No size, then it's probably not a valid pic.
// No size, then it's probably not a valid pic.
if ($sizes === false)

Then run the package manager and magic will happen  :D  :D  :D  :D  :D   

My forum is now   2.0.16 :-)    Thank you very much, Shawnb61

Offline Alain Rheault

  • Semi-Newbie
  • *
  • Posts: 16
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #10 on: December 29, 2019, 01:16:17 PM »
  8)  Did the update of the CLONE of my Forum ... and it went FINE !   many Thanks  for 2.0.16 version !

I did not give my ID and Password,  changed the line of sécuty  with = 1 instead of = 0 ,  your script for that little bypass process work whell for me ! 

Now --- i'm doing some test on the CLONE and tomorow i will upgrade tje real one     O:)

Offline rty42

  • Newbie
  • *
  • Posts: 4
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #11 on: December 30, 2019, 12:24:00 PM »
This seems weird to me. I have four SMF 2.0.15 forums to upgrade, all of them has this upgrade issue.
I checked the two simple cases (one has only a single MOD (like posts) and the other has one MOD and three smiley packs), and found that no mods affecting Profile-Modify.php is present on any of them. I even uninstalled the single MOD to have a plain MOD-free SMF 2.0.15 and the update still failed because of the lack of the double comment.

My suspicion is that whenever the double comment got introduced to this file it only appeared in the full installation package, but did not appear in the file when updating a forum from an earlier version. All my forums are relatively old, I see "SMF 2.0.4 Update" in the package manager at all of them so I thing they were installed as 2.0.3 or even earlier...

I do the upgrade by manually adding the duplicate comment as suggested and it works for me too, but this issue may affect a lot of users... so maybe making the removal of the extra comment optional would be a good idea.

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,711
    • sbulen on GitHub
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #12 on: December 30, 2019, 12:55:21 PM »
My suspicion is that whenever the double comment got introduced to this file it only appeared in the full installation package, but did not appear in the file when updating a forum from an earlier version. All my forums are relatively old, I see "SMF 2.0.4 Update" in the package manager at all of them so I thing they were installed as 2.0.3 or even earlier...

I do the upgrade by manually adding the duplicate comment as suggested and it works for me too, but this issue may affect a lot of users... so maybe making the removal of the extra comment optional would be a good idea.

Thanks for that input - helpful.  Not sure we can do anything about it as the patch is out in the wild already.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,838
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #13 on: December 30, 2019, 01:48:53 PM »
I noticed that too on my files, I first thought it was my mods. I checked my mods but nothing edited that part/file either.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 1,711
    • sbulen on GitHub
Re: upgrade 2.0.15 --> 2.0.16 fail
« Reply #14 on: December 30, 2019, 05:08:16 PM »
I saw it on my prod forum, patched since 1.1.   (I assumed I cleaned it up at some point...  Things like that drive me nuts...)

I did not see it on any of my test environments, variants of installs & patches from 2.0.13 or later. 

I think rty42 is correct - it will affect older forums. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp