Forums / General Questions / PHP "list" function interface change for PHP 7.0

PHP "list" function interface change for PHP 7.0

Views: 710

Results 1 to 4 of 4
14 Jan 2016, 2:28 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

PHP "list" function interface change for PHP 7.0

I was going through some PHP function definitions and came across the following warning for the list function:

[B]Warning[/B]:  In PHP 5, list() assigns the values starting with the right-most parameter. In PHP 7, list() starts with the left-most parameter. 

Is that going to cause issues in the Zen Cart base code?

14 Jan 2016, 4:02 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP "list" function interface change for PHP 7.0

In all the testing I've done I've not run into any issues with this.

I think it's because the ZC code doesn't do [] notation in its use of the list function, such as:```
list($a[], $a[], $a[]) = [1, 2, 3]; // this gives different results in PHP5 vs PHP7

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Jan 2016, 4:12 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: PHP "list" function interface change for PHP 7.0

Thanks, DrByte. I (obviously) didn't read the fine print on that warning!

14 Jan 2016, 4:20 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP "list" function interface change for PHP 7.0

Haha. At least you made me spend a half hour to investigate and run a bunch of code samples thru multiple versions! I think I'm satisfied that there's no incompatibility in this case.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.