Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: AlanDewey on December 28, 2019, 09:48:58 AM

Title: upgrade 2.0.15 --> 2.0.16 fail
Post by: AlanDewey 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

* 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: m4z on December 28, 2019, 10:41:36 AM
Quote from: AlanDewey on December 28, 2019, 09:48:58 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: m4z on December 28, 2019, 10:44:43 AM
Quote from: AlanDewey on December 28, 2019, 09:48:58 AM
get this failure notice

* 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?
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Rob Lightbody 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.

$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" ?
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: AlanDewey 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?
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Rob Lightbody on December 28, 2019, 11:18:40 AM
Quote from: AlanDewey on December 28, 2019, 11:10:08 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: shawnb61 on December 28, 2019, 02:06:00 PM
Let's start with QE2... 

~Line 2688, your file has:
$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:
$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...
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: t-geronimo 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:

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


[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!
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Rob Lightbody on December 29, 2019, 08:54:41 AM
I'm all sorted now, thanks for your help on this!
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: AlanDewey 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 !

$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
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Alain Rheault 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:)
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: rty42 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: shawnb61 on December 30, 2019, 12:55:21 PM
Quote from: rty42 on December 30, 2019, 12:24:00 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: vbgamer45 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.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: shawnb61 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. 
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Vince S on January 30, 2020, 11:57:18 PM
Still an issue. Our forum has various mods and has existed since 1.0.bugger all. Putting the duplicate comment in as per summarised by Alan on 30th Dec fixed it, went through smoothly then. I am guessing there are a lot out there on 2.0.15 that will not see 2.0.16 and hoping 2.0.17 sorts it. Perhaps this is sufficient justification to warrant the release of an interim 2.0.17? Seems like it to me but hey, we are sorted, so it is only those tens of thousands of others.... :)

And here's a PS: OK, so 2.0.17 is out now and that upgraded just fine. The package manager wouldn't tell me about 17 until I had 16 installed. So it turns out this is a road block and the actual 16 package needs to be updated to remove this error and stop a whole bunch of ppl that DIDN'T read these posts getting frozen out on 2.0.15...
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Tomcraft on January 31, 2020, 04:02:05 AM
Quote from: shawnb61 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.

Yes, he is right. The duplicate comment line came in full version of SMF 2.0.6 (but seems like it was not added in the update patch), so if you started your forum with an earlier version of SMF you will not have the duplicate comment line and need to manually duplicate the line for the package manager to work.

Regards, Torsten
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Vince S on January 31, 2020, 09:02:29 PM
So that means it IS broke. No old forum user will get to upgrade past 2.0.15, unless they come and do this dysfunctional double comment solution thing.

Looks like a 'crisis point', sounds like one. Smells like one.

Lucky we didn't tread in it!!!

Hang on, IT'S A CRISIS FOR SMF, anyone going to figure out a solution and get it implemented?

The only solution I can see is that the 2.0.16 upgrader needs to be modified so it doesn't generate the fatal fail. The status quo of expecting all the long term users to come and find this bs trip point that renders their forums un-upgradeable by (most) mere mortals, and that all of them make this mod of ridiculousness to get over a hurdle that snuck out the gate and torched the ecosystem is kinda, well, totally (fill in your expletive of choice).

IT'S A CRISIS PEOPLE, and wrecks all the good work that has come after 2.0.15 by all those cool hard working volunteer types; please deal with it effectively. Thank you.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Illori on February 01, 2020, 05:58:37 AM
we do not modify a patch after it has been released. so this has to be fixed by users posting on the forum asking for assistance.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Vince S on February 01, 2020, 06:16:00 AM
Any other time I would agree with that, except when it gives a la-la land outcome. All those mums 'n dads forums out there using smf will have about 5% who are software savvy. Heck it could be 15%. The rest just want nice forum software and if it doesn't work properly they just work around it. This is reality.

So the questions are:

1) Roughly how many pre 2.06 (is it?) SMF's are out there? Multiply that by 90% (say) and get a number. How does that compare to the 900 or so that have looked at this topic (presumably actually 90 ish if they all looked at every post) in the month since the issue first surfaced? So we have a number of 'potential victims'.

2) The ONLY ways for such affected persons to get through the problem are to find this topic AND be able to implement it (lost 50% there), OR do a reinstall.

3) Looking at the above numbers, does anybody care?

This kind of issue is so 'special' that all standard protocols become irrelevant. The whole purpose of SMF was to get good forum software out there in the hands of all those small operatives that could really use something free and good. And it is now broken, and staying broken, for whatever number of real actual people you care to dream up from the above.

'We' are a lot better than that. It is broke and there is no excuse for not fixing it. Or simple reality is that 2.0.15 is as good as it gets for rather a lot of people and no amount of vacuous 'protocol' on some forum will change that. It needs fixing, and soon. I would think an 'all users' notice is also mandatory to inform situation and advise actions.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Illori on February 01, 2020, 06:26:31 AM
sorry we are not changing our policy, it has caused us major issues in the past. the patch once released will NOT be changed.

also the number of views on a specific topic have no relevance to how many need to use the assistance provided in that topic. a lot of spiders crawl this forum and that is where a lot of the hits come from. you cant say that 90 people have needed help from this topic without 90 people posting they actually did.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Vince S on February 01, 2020, 06:39:20 AM
Sorry, I am not meaning to be confrontive or something, or try to make silly / flaming style arguments; if it seems that way it is not intended.

In essence, I suspect but don't know that there are tens of thousands of users affected by this issue and maybe a few of them (like 90) may have found a solution. The other still tens of thousands are ignorant of the fact they even have a problem.

I personally did not know of the 2.0.16 udpate. I am pretty sure I usually get an email for any update but none came, or something happened. Same for 2.0.17, no notice. Maybe it has an outdated email from the old DNS so it is just me? But the point is I had our forum on 2.0.15 in blissful ignorance, just stumbled across this fact when doing something else. Do the upgrade, get the fail, come here and search and there is the identical error, so I fixed it.

Then realised this is a way bigger issue than it first seemed as all existing users are locked out, in effect.

You would never design in a bug to create that outcome. How there is any concept that this fatal flaw could be left as is defies any logical assessment. So how about we deal with content rather than resort to dogma? Thank you.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Illori on February 01, 2020, 08:28:26 AM
we have not sent out the newsletter due to a bug in our servers here. hopefully that will be resolved soon.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: alkisg on February 13, 2020, 05:50:56 AM
Quote from: shawnb61 on December 30, 2019, 12:55:21 PM
Thanks for that input - helpful.  Not sure we can do anything about it as the patch is out in the wild already.

This happened to my (very old, with no mods) forum as well. Thank you all for the solution provided here.
I think it would be nice to make a remark of this issue/topic/solution in the release announcement message (https://www.simplemachines.org/community/index.php?topic=570986.0), so that users don't have to google to find the solution.
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: Peter de la mare on March 02, 2020, 08:23:30 AM
This was very helpful, thank you. 

Quote from: shawnb61 on December 28, 2019, 02:06:00 PM
Let's start with QE2... 

~Line 2688, your file has:
$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:
$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...
Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: otsian on March 26, 2020, 11:53:20 AM
Well just my luck. I'm trying to catch up on the releases and am stuck here. I've change Profile_Modify.php to have the double comment, still fails the test.

I'm looking at the updates for Profile-Modify.php and am slightly confused. In reporting the package installation error, SMF lists

Replace - Test Successful
Add After - Test Successful
Replace - Test Successful
Add After - Test Successful
Add Before - Test Successful
Replace - Test Failed

When looking at the package code, it appears to have a different list of operations for the update. I must not be understanding how this operates. It shows:

Replace
Before
Replace
Before
After
Replace

It seems like those might align provided their they're referring to the code differently in each place, where one refers to the position of the original code and the other to where new code goes. Confuses me, but hey, me being confused isn't a new thing. :)

So anyway, I've reviewed each of the replace items, and they all appear to be identical. The last replace in either is certainly the double comment item.  I've deleted the 2.0.016 mod and re-downloaded it, and it's still failing the test.

Is there some other issue that can be at play here? Any guidance would be very welcome.

Title: Re: upgrade 2.0.15 --> 2.0.16 fail
Post by: otsian on March 27, 2020, 09:14:51 AM
Well, I went and did the update, and manually did the last replace it skipped afterwards. The update itself said it was successful, which seems like it shouldn't have said that since it clearly didn't do that last replace section. Poking through the other replaces, they appeared to have been performed fine.

Then I went ahead and did the update to .17 as well, which ran fine.

I wish I understood why it wasn't finding that last replace. It appeared identical to what it was searching for. Oh well. I guess I'm past this issue.