PHP 7.2 upgrade

Good evening,

I recently upgraded PHP on my Archlinux webserver from version 7.1 -> 7.2.
With PHP errors displayed, this appears to through a deprecation error for the even() call on line 81 in the MX/Modules.php file. I assume that because this is third party, it will have to be fixed upstream. If so, I just wanted to know if this still functions, and was an acceptable thing to ignore with PHP errors hidden, or if I need to roll back all my sites to using 7.1.

Thanks,

Clayton

A PHP Error was encountered
Severity: 8192

Message: The each() function is deprecated. This message will be suppressed on further calls

Filename: MX/Modules.php

Line Number: 81

Backtrace:

File: /srv/http/invoice.littleendian.tech/application/third_party/MX/Modules.php
Line: 81
Function: each

File: /srv/http/invoice.littleendian.tech/application/third_party/MX/Loader.php
Line: 269
Function: load

File: /srv/http/invoice.littleendian.tech/application/core/Base_Controller.php
Line: 72
Function: module

File: /srv/http/invoice.littleendian.tech/application/core/User_Controller.php
Line: 25
Function: __construct

File: /srv/http/invoice.littleendian.tech/application/core/Admin_Controller.php
Line: 20
Function: __construct

File: /srv/http/invoice.littleendian.tech/index.php
Line: 327
Function: require_once
1 Like

IP was not tested with PHP 7.2 yet, I mean it’s just out for a few days.
Roll back for now and stay tuned for an update.

2 Likes

@Kovah
Just checking on the status of this issue. I noticed a few updated libraries since then, notably mPDF and PHPMailer.

I’d really like to get my webservers patched current if possible.

Thanks,

Clayton

@xerxies PHP 7.2 compatibility was resolved in version 1.5.7 :blush:

1 Like

resolved is a big word :smiley:
More seriously the bug was hidden but not fixed (@Kovah you will be slapped for this shame :D)

Feel free to test IP with 7.2 and report any bugs or something which is not working anymore

1 Like

Oh dear :see_no_evil::see_no_evil:

Sure! not problem 7.1

The PHP developers deprecated mcrypt in version 7.1, and removed support in version 7.2. Applications should use other solutionions like openssl for encryption needs.

If you do decide to install the mcrypt PECL module for PHP 7.2, you’d need to do so using the following commands FOR CPANEL:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install libmcrypt
yum install libmcrypt-devel
/opt/cpanel/ea-php72/root/usr/bin/pecl install channel://pecl.php.net/mcrypt-1.0.1

Did we just get spammed above? Moderator?

You can always use the flag underneath the post to report a post. This way all admins and moderators will get a notification.

May I ask kindly for PHP 7.3 Support.
Currently I’m running on PHP v7.2.13 but as all other Webapps are running on PHP 7.3 this would be awesome!
If I can help with logs let me know

#EDIT: I just post the Error after switching to PHP 7.3 here

#### A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: MX/Router.php

Line Number: 224

Backtrace:

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/application/third_party/MX/Router.php
Line: 224
Function: strpos

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/application/third_party/MX/Router.php
Line: 71
Function: set_class

File: /var/www/vhosts/domain.tld/httpdocs/rechnung/index.php
Line: 325
Function: require_once

UPDATE:

think I have made it compatible with PHP v7.3.x
But I think this needs a bit of testing.

What I changed:

/application/third_party/MX/Router.php

Row 221-228

public function set_class($class)
    {
        $suffix = $this->config->item('controller_suffix');
        if (strpos($class, $suffix) === false) {
            $class .= $suffix;
        }
        parent::set_class($class);
    }

changed to:

public function set_class($class)
    {
        $suffix = (string) $this->config->item('controller_suffix'); 
        parent::set_class($class);
    }

I think casting $suffix to string is appropriate if controller_suffix is(or can be) empty.
Can someone pls confirm its working?

Just added it here: https://github.com/InvoicePlane/InvoicePlane/pull/680#issuecomment-453630154

4 Likes

ah great! Just also found out php 7.3 is not supported yet in Version 1.5.9
Would be great, as this has a great speed performance upgrade against php 7.2

Thanks Martin! I just upgraded my server to v7.3 and came across this article after seeing the Invoice Plane error. I just updated the router.php per your suggestion and the error went away. The site appears to be working correctly without any issues. Thanks for you help!

1 Like

You are very welcome!
Hope the Dev-Team will include this fix ASAP as it will not break anything in PHP 5.6 and adds support up to PHP 7.3 (and maybe even beyond).

Thanks for your feedback and for using the Forum instead of just opening another Thread with a Issue that already have been solved :wink:

2 Likes

Will make sure this is merged when I get back from working away.

3 Likes

I’m new to Invoice Plane and hosting.

So toady I was trying to install Invoice plane via Softaculous since it’s more easy for me and I recived those errors:

  The following errors were found :

Required PHP extension not found : mcrypt
Required PHP extension not found : mysqli

On my webhosting PHP 7.3 is installed

I’ve found that I could enable “nd_mysqli” here:

But I did not see anything about “mcrypt” so my question is how I could implement easily this fix to be able to use Invoice Plane ? :thinking:

I really like to be able to install it with Softaculous since I never used database in hosting before.

Or at least to have a step by step instructions on how to do it…

I have crated a subdomain to put InvoicePlane in the form of Invoiice.MyDomain.com.

Does it would be better to use the version 2 ?

Regards !

Pls open a new Thread for this problem, as this is not related to PHP 7.2/PHP7.3 Upgrade.

But pls do not use IP2 becasue this is not the right version 2.
Stay at IP1 untill they will release the official version 2.

1 Like

Sorry but it seem related since PHP 7.3 from what I understand has deprecated "mcrypt extension in favor of open ssl.

So I don’t understand how you could conclude that it’s not related to PHP 7.3

invoiceplane.com need "mcrypt to encrypt passwords/database

And the documentation state clearly that it should work witn PHP 7 or higher when in fact mcrypt was deprecated and removed from PHP 7.2/7.3

The depreciation of php-mcrypt is perhaps going to be a bit of a headache for a while, especially as more people move from the now unsupported php 5.6 to the likes of 7.2 and 7.3.

I’ll be going through and getting things updated as best I can in the coming days, the day job has had me travelling extensively these last weeks but some normality is on the horizon.

1 Like