Page 1 of 2

PHP 7.2 Support?

Posted: Thu Mar 01, 2018 5:31 am
by davidbfranks
Does OpenCart support PHP 7.2? Has anyone tested it?

Apparently there are significant performance increases, see this article - https://kinsta.com/blog/php-7-hhvm-benchmarks/

Re: PHP 7.2 Support?

Posted: Thu Mar 01, 2018 11:24 am
by IP_CAM
Well, that's all carbage talk, they said that already about PHP 7.0,
and it did not change a thing for OC. But since you want to find out,
what's keeping you from trying it out, you won't have to change
anything in the OC configuration.
Ernie

Re: PHP 7.2 Support?

Posted: Thu Mar 01, 2018 5:43 pm
by davidbfranks
IP_CAM wrote:
Thu Mar 01, 2018 11:24 am
Well, that's all carbage talk, they said that already about PHP 7.0,
and it did not change a thing for OC. But since you want to find out,
what's keeping you from trying it out, you won't have to change
anything in the OC configuration.
Ernie
Look at the benchmarks (in the link I posted) they speak for themselves....

I will test it, just didn't want to waste my time in case someone else already had.

Re: PHP 7.2 Support?

Posted: Thu Mar 01, 2018 6:07 pm
by straightlight
The best way to know is to contact your host and ask them to upgrade to PHP 7.2. Then, test Opencart on a server environment before removing site maintenance on your live store due to server change.

Re: PHP 7.2 Support?

Posted: Fri Mar 02, 2018 4:19 pm
by davidbfranks
I asked OpenCart about this, they said:
Normally, we prefer the Opencart system to run in PHP 5.6.
There may be some bug or error with you run in PHP 7.X.

If you have any question, please feel free to let us know.
Thanks and regards,

Alex
Opencart Team

Re: PHP 7.2 Support?

Posted: Sat Mar 03, 2018 8:15 am
by straightlight
I don't know where this information has been taken from but one thing is for sure; the PHP Industry did abolished some functions and even tweaked some existing functions that may not be implied the same way as previous PHP versions were using and that Opencart is still is using. So far, by diagnosing the code, the issue is NOT with PHP but rather the dev team who supports it and might not be adapted or lacking with the new infrastructure of what the Industry has provided within the last year or two.

Re: PHP 7.2 Support?

Posted: Sat Mar 03, 2018 9:17 am
by IP_CAM
Look at the benchmarks (in the link I posted) they speak for themselves....
Well, those benchmarks do NOT include OpenCart, and I have made a bunch of real-time
Tests, by use of my peaked Test OC's, and always packed at least with 2K Products,
and not getting ANY result, better than before. But I am also aware of, that getting an OC
20 products Category GTMetrix Result from 98% up to 99% is not that easy either... ::)
And what counts for me is, what a Visitor gets, and not some theoretical Benchmarks.

However, I cannot speak for latest OC Versions, since I use v.1.5.6.5, but combined
with V.2.x Bootstrap Themes, and PHP 7.0.x will be the End of the Line for this Version,
without changing some of the existing Code. Still, there was no measusable difference
to PHP 5.x, used before, performance-wise, and from a Visitor Point of View.
But I am also aware of the Fact, that some Responsive Themes drop GTMetrix Results
by 15%+ Performance Points, without adding anything else, but themselfs... 8)
As you can see on the image just below...

But for those, using MySql before, the also required change to MySqli is a giant
step upwards, but this has nothing to do with PHP-7 either, just to mention this as well.
There are lots of things, keeping OC from doing, what it could, but as long as
OC Users fill their Pages with all that crab, available in the Extension Sections,
it's just a Dream, to expect an OC to work better, just by changing to PHP 7.2.x.
Ernie
---
Another Theme, and I tried everything, but that's the best I got out of it, so, I dropped it from the list...
Image
---
Image
---
Link to large image:
download/file.php?mode=view&id=34065

Re: PHP 7.2 Support?

Posted: Thu Mar 08, 2018 1:45 pm
by qahar
I'm doing two compatibility test for OpenCart current master branch, commit e8a0a91 March 5, 2018.

# PHP CodeSniffer Compatibility

Test against PHP between version 5.4 - 7.3

Code: Select all

phpcs -p . --extensions=php --standard=PHPCompatibility --runtime-set testVersion 5.4-7.3 --report-summary=./phpcs_compat_summary.txt --report-full=./phpcs_compat_full.txt
Conclusion: no conclusion report, maybe screenshoot can help.
phpcs-compatibility.png

phpcs-compatibility.png (23.24 KiB) Viewed 20824 times

Detailed report in attachment.
Quite details report including files, code line and the description.

# PHP CompatInfo

Test command

Code: Select all

php phpcompatinfo.phar analyser:run . --output=phpcompatinfo_result.txt

Conclusion: Requires PHP 5.6.0 (min), PHP 7.0.2 (all)

Detailed report in attachment.
Contain summary for required PHP ext; namespace, class, method enalysis etc

I suggest to take look both result, because in PHP CodeSniffer compatibility report there is errors indicating issue in PHP 7.1 and 7.2
But it was only at certain library and vendor which not all user might use them.

.

Re: PHP 7.2 Support?

Posted: Thu Mar 08, 2018 8:14 pm
by schiggi
Using OC 2.3 in production with PHP 7.1. Works very well.

PHP 7.2 removed mcrypt extension. Since OC3, mcrypt was replaced, so I guess, it will work fine as well. The functions changed in the newest PHP versions don't affect OC. However, some extensions might be not up to date but from my experience with professional, large extension developers, that should not be a problem.

Re: PHP 7.2 Support?

Posted: Mon Apr 29, 2019 8:42 am
by davidcropley
I found that OC 3.0.1.1 Would run with php 7.2 but very slowly and I kept getting Server error pop-up. I couldn't figure out why until I switch to php7.1 and now my site runs pretty quick without the errors. I think we have to remember that the best version of PHP to use will be the version that was available at the time of the individual OC version release, as it's likely the code will be written for cross-compatibility with the PHP release for that same era.

Re: PHP 7.2 Support?

Posted: Mon Apr 29, 2019 9:53 am
by IP_CAM
davidcropley wrote: I found that OC 3.0.1.1 Would run with php 7.2 but very slowly and I kept getting Server error pop-up.
Try this one instead: ;)
system/library/encryption.php
should work with most all OC Versions, I guess,
just remove the File End php Tag ?> , if you use OC v.2+ Versions.
( aware of, that I would not need it either, but I like it, like it or not :P )
My Way of closing doors, just to make real sure, they're locked ... :laugh:

It seems to have some advantages over other ways of coding aes-xx,
but I'm not capable to judge on such, I just use it, and it works well
up to PHP v.7.2x so far.
Good Luck! :D
Ernie

Code: Select all

<?php
final class Encryption {
	public function encrypt($key, $value) {
	$encryption_key = base64_decode($value);
	$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-gcm'));
	if (in_array('aes-256-gcm', openssl_get_cipher_methods())) {
		$tag = base64_encode($iv);
		$encrypted = openssl_encrypt($key, 'aes-256-gcm', $encryption_key, 0, $iv, $tag);		   
		return base64_encode($encrypted . '::' . $iv);
		}
	}
	public function decrypt($key, $value) {
	if (in_array('aes-256-gcm', openssl_get_cipher_methods())) {
		$encryption_key = base64_decode($value);
		list($encrypted_data, $iv) = explode('::', base64_decode($key), 2);
		$tag = base64_decode($iv);
		return openssl_decrypt($encrypted_data, 'aes-256-gcm', $encryption_key, 0, $iv, $tag);
		}
	}
}
?>

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 12:14 am
by ADD Creative
That replacement for system/library/encryption.php is just wrong and will never work. You can read my explanation here. viewtopic.php?p=737337#p737337

If you did want an improved system/library/encryption.php, try looking at the two examples here.
viewtopic.php?p=737628#p737628

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 12:28 am
by straightlight
ADD Creative wrote:
Wed May 01, 2019 12:14 am
That replacement for system/library/encryption.php is just wrong and will never work. You can read my explanation here. viewtopic.php?p=737337#p737337

If you did want an improved system/library/encryption.php, try looking at the two examples here.
viewtopic.php?p=737628#p737628
You might also want to find the right explanation for PHP v7.3+. Unfortunately, both versions may seem to be wrong in this case.

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 12:31 am
by ADD Creative
In what way are they wrong for PHP 7.3?

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 1:42 am
by straightlight
It would seem since January 27 2019, php-sodium is compatible with PHP v7.3: https://pecl.php.net/package-changelog. ... ase=2.0.21 but also provides instructions to revert to prior PHP versions afterwards for some reasons until php-sodium v2.0.2.1.

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 4:24 am
by IP_CAM
That replacement for system/library/encryption.php is just wrong and will never work.
Well, in my case, it works perfect up to PHP 7.2x, so,what can I say ?
Ernie

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 4:26 am
by straightlight
Despite if it works for v7.2, in this case, since the latest php-sodium library is not officially ready for all PCI servers yet with hosting licenses. A bunch might still be a bit behind which, unfortunately, might encounter minor issues with PHP v7.3 at this time.

Re: PHP 7.2 Support?

Posted: Wed May 01, 2019 4:58 am
by IP_CAM
Whatever, I now replaced my encryption file with that SODIUM_CRYPTO File,
and it seems to work with my latest Server PHP 7.2.17 Version too. :D
But I have not yet PHP 7.3 on my Server, to make further tests.
Ernie

Re: PHP 7.2 Support?

Posted: Sun May 05, 2019 5:56 am
by ADD Creative
You need to do more then just replace system/library/encryption.php. As until the encryption is used you won't see the errors.

The code below can be used to test.

Code: Select all

$original_message = 'Test message for encryption';
$encrypted_message = $this->encryption->encrypt($this->config->get('config_encryption'), $original_message);
$decrypted_message = $this->encryption->decrypt($this->config->get('config_encryption'), $encrypted_message);

if ($decrypted_message !== $original_message) {
	throw new Exception('Encryption failed');
}
Just make sure it is at some point after this line. And remember to remove after testing.

Code: Select all

$this->registry->set('encryption', new Encryption($this->config->get('config_encryption')));
Both the two examples posted here work. Tested with PHP 7.3.4.
viewtopic.php?p=737628#p737628

The one posted in this topic doesn't.

Re: PHP 7.2 Support?

Posted: Sun May 05, 2019 11:56 am
by straightlight
Both the two examples posted here work. Tested with PHP 7.3.4.
The addressed post should then be edited to specify the compatibility with PHP 7.3.4 in the mean time to avoid confusion. Also, I have found a pull commit request on GitHub regarding this file as well. Perhaps this may help but I haven't tested it yet: https://github.com/opencart/opencart/pu ... ac85c6074d