Bug #80736 [NEW]: array_uintersect parameters difference
| From: | jurigag at gmail dot com | Date: | Fri, 12 Feb 2021 09:53:44 +0000 |
| Subject: | Bug #80736 [NEW]: array_uintersect parameters difference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232082@lists.php.net to get a copy of this message | ||
From: jurigag at gmail dot com
Operating system: Ubuntu 18.04
PHP version: 8.0.2
Package: Reflection related
Bug Type: Bug
Bug description:array_uintersect parameters difference
Description:
------------
When using PHP8 ReflectionFunction::getNumberOfParameters() for
array_uintersect returns 2 and also they look like this:
array(2) {
[0]=>
object(ReflectionParameter)#2 (1) {
["name"]=>
string(5) "array"
}
[1]=>
object(ReflectionParameter)#3 (1) {
["name"]=>
string(4) "rest"
}
}
But for PHP7 it was looking like this:
array(3) {
[0]=>
object(ReflectionParameter)#2 (1) {
["name"]=>
string(4) "arr1"
}
[1]=>
object(ReflectionParameter)#3 (1) {
["name"]=>
string(4) "arr2"
}
[2]=>
object(ReflectionParameter)#4 (1) {
["name"]=>
string(26) "callback_data_compare_func"
}
}
Change itself isn't documented on docs, not sure why it was changed, but
also when executing this function it works as it was previously.
Test script:
---------------
<?php
$array1 = array("a" => "green", "b" => "brown",
"c" => "blue", "red");
$array2 = array("a" => "GREEN", "B" => "brown",
"yellow", "red");
print_r(array_uintersect($array1, $array2, "strcasecmp"));
$reflection = new ReflectionFunction('array_uintersect');
var_dump($reflection->getNumberOfParameters());
var_dump($reflection->getNumberOfRequiredParameters());
var_dump($reflection->getParameters());
Expected result:
----------------
Array
(
[a] => green
[b] => brown
[0] => red
)
int(3)
int(3)
array(3) {
[0]=>
object(ReflectionParameter)#2 (1) {
["name"]=>
string(4) "arr1"
}
[1]=>
object(ReflectionParameter)#3 (1) {
["name"]=>
string(4) "arr2"
}
[2]=>
object(ReflectionParameter)#4 (1) {
["name"]=>
string(26) "callback_data_compare_func"
}
}
Actual result:
--------------
Array
(
[a] => green
[b] => brown
[0] => red
)
int(2)
int(1)
array(2) {
[0]=>
object(ReflectionParameter)#2 (1) {
["name"]=>
string(5) "array"
}
[1]=>
object(ReflectionParameter)#3 (1) {
["name"]=>
string(4) "rest"
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80736&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80736&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80736&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80736&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80736&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80736&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80736&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80736&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80736&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80736&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80736&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80736&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80736&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80736&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80736&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80736&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80736&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80736&r=mysqlcfg