Fixed json_decode error if non-JSON response when downloading for one-click upgrade

Comsup

Member
Just tried upgrading and it failed with these errors.
 

Attachments

  • 61F1E450-A09D-48F6-824D-ADFB750E793B.png
    61F1E450-A09D-48F6-824D-ADFB750E793B.png
    414.8 KB · Views: 37

Mr. Jinx

Well-known member
Did you really try to upgrade from you mobile phone? That's brave :eek:
I would never do that. It is better to sit behind a console, take your time, make a backup (or use a test install) and then upgrade.
In case something weird happens, you can revert to the backup.

The screenshot is also very hard to read, it does not show the full error.
 

Chris D

XenForo developer
Staff member
Sorry for moving the thread about.

Technically I'm not sure this is a bug exactly, though it isn't particularly clear what you're running into.

The response you're getting when you download XF seems to be some sort of HTML which is not what we return. We should probably handle that a little more cleanly, so a clearer error is returned, and that's why I'm keeping this in the bugs forum and have changed its title.

If you try again do you get the same result? If so, please submit a ticket from your customer area and, ideally, please provide FTP/files access to your server so we can check what is being returned here.
 

Comsup

Member
Yes, I like to live on the edge.

Here’s the full error log. Any ideas would be appreciated.

  • InvalidArgumentException: json_decode error: Syntax error
  • src/vendor/guzzlehttp/guzzle/src/functions.php:304
  • Generated by: Number 6
  • Sep 15, 2021 at 5:41 AM

Stack trace​

#0 src/XF/Service/Upgrade/Downloader.php(60): GuzzleHttp\json_decode('<html>
<head><...', true)
#1 src/XF/Admin/Controller/Tools.php(492): XF\Service\Upgrade\Downloader->download(2020770, 1631615533, NULL)
#2 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Tools->actionUpgradeXf(Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'UpgradeXf', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#4 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#5 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#7 src/XF.php(512): XF\App->run()
#8 admin.php(13): XF::runApp('XF\\Admin\\App')
#9 {main}

Request state​

array(4) {
["url"] => string(27) "/admin.php?tools/upgrade-xf"
["referrer"] => string(57) "https://communications.support/admin.php?tools/upgrade-xf"
["_GET"] => array(1) {
["tools/upgrade-xf"] => string(0) ""
}
["_POST"] => array(2) {
["confirm_version_id"] => string(7) "2020770"
["_xfToken"] => string(8) "********"
}
}
 

Comsup

Member
Sorry for moving the thread about.

Technically I'm not sure this is a bug exactly, though it isn't particularly clear what you're running into.

The response you're getting when you download XF seems to be some sort of HTML which is not what we return. We should probably handle that a little more cleanly, so a clearer error is returned, and that's why I'm keeping this in the bugs forum and have changed its title.

If you try again do you get the same result? If so, please submit a ticket from your customer area and, ideally, please provide FTP/files access to your server so we can check what is being returned here.
No problem Chris and thanks. I will try the upgrade again in 30 minutes and see what happens.
 

Comsup

Member
I ran the upgrade again and it appears to have completed successfully. No clue as to what happened the first time, but I wanted to check with the team before trying again.
 

Chris D

XenForo developer
Staff member
It's possible you hit some sort of error page unexpectedly or CloudFlare got in the way.

We'll try and make the error a little less obnoxious and include advice to "try again later".

Glad it got sorted on its own!
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.8).

Change log:
Throw a prettier error if downloading an XF upgrade package fails
There may be a delay before changes are rolled out to the XenForo Community.
 
Top