Upgrade from v4.5.19 to v4.5.20 breaks site (self-hosted)

Hi,

Got an alert from cPanel dashboard to update Invoice Ninja v4.5.19 to v4.5.20 today, upon upgrading via Softaculous I got an error saying:

The following errors were found:

  • Required PHP extension not found: fileinfo
    Screenshot 2020-11-03 124933

So I enabled fileinfo via PHP version 7.4

Re-started the upgrade and it finished but only to find the upgrade broke the site, I got the following:

I tried overwriting the files manually via FTP but it was still broke.

Luckily I was able to roll back to my older version via backup on my server, I’m now back to v4.5.19 and all is working again.

Any help is much appreciated.

Kieran

Hi,

Are there any related errors in storage/logs/laravel-error.log

Hi Hillel,

Thanks for your response.

Because I rolled back to a server back-up it’s now working again on v4.5.19 there would be no upgrade error in laravel-error.log unless I repeat the upgrade again.

I might setup a staging version to try out the upgrade again.

On another note would upgrading to V5 be the better option? I looked at the documentation and when clicking on Start Migration the next step is also broken for me, I have Invoice Ninga installed in a sub directory like:

mydomain.com/ninjainvoice

Clicking on Start Migration wants to take me to mydomain.com/migration/start which is a bad url.

To upgrade from v4 you need to install v5 as a separate app but you’ll want to first upgrade your instance to 4.5.20

OK Hillel I will try again, I’ll keep you posted here on how that it progresses.

Thanks

Kieran

Hi @hillel,

I setup a staging site and tried the upgrade again, here’s what happened.

On the staging site there was the option to upgrade to v4.5.21 so I proceeded. Upon upgrade I got the same error message:

Had a look at storage/logs/laravel-error.log which revealed the following:

[2020-11-08 12:20:54] production.ERROR: ***ErrorException*** [0] : /home/root/public_html/invoiceninja/app/Models/Account.php [Line 1126] => Unparenthesizeda ? b : c ?: dis deprecated. Use either(a ? b : c) ?: dora ? b : (c ?: d) {"context":"PHP","user_id":1,"account_id":"1","user_name":"","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36","locale":"en","ip":"","count":4,"is_console":"no","is_api":"no","db_server":"mysql","url":"/"} []

Through trial and error I managed to fix the issue at line 1126 by putting parenthesis around this:

$this->currency_id:

       $currencyId = ($client && $client->currency_id) ? $client->currency_id : ($this->currency_id) ?: DEFAULT_CURRENCY;
    $locale = ($client && $client->language_id) ? $client->language->locale : ($this->language_id ? $this->Language->locale : DEFAULT_LOCALE);

The staging site is now running on v4.5.21 with the above fix.

Where can I get V5 and is there any documentation on upgrading?

Thanks

Kieran

Hi,

Please check you aren’t using PHP 7.4, only up to 7.3 is supported with v4.x

Hi @hillel, That sorted out the issues. I am running PHP 7.4 accross the server but added this to Invoice Ninja .htaccess file to run independently at PHP 7.3

# Use PHP73 as default AddHandler application/x-httpd-php73 .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/php73/lib </IfModule>

Now running version v4.5.21

1 Like