phpbb / epv

Extension Pre-Validator
GNU General Public License v2.0
9 stars 17 forks source link

fixed #66 #67

Closed canonknipser closed 6 years ago

canonknipser commented 6 years ago

Added warning for list()

iMattPro commented 6 years ago

I'm not sure we need this. This test is for functions we don't want people using within phpBB. We do not need to discourage list() because this change for PHP 7 is hardly going to affect any one who does use it.

These results are identical, whether using 5 or 7:

$info = array('coffee', 'brown', 'caffeine');
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.";

# coffee is brown and caffeine makes it special.

Likewise this is identical results too:

$info = array('coffee', 'brown', 'caffeine');
list($a[0], $a[1], $a[2]) = $info;
echo "$a[0] is $a[1] and $a[2] makes it special.";

# coffee is brown and caffeine makes it special.

The difference between 5 and 7 is just the array order (note index associations are still same):

Output of $a in the above example in PHP 7:
array {
  0 => "coffee"
  1 => "brown"
  2 => "caffeine"
}

Output of $a in the above example in PHP 5:
array {
  2 => "caffeine"
  1 => "brown"
  0 => "coffee"
}