|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-02-12 15:51 UTC] requinix@php.net
-Type: Bug
+Type: Documentation Problem
-Package: Reflection related
+Package: Arrays related
[2021-02-12 15:51 UTC] requinix@php.net
[2021-02-12 15:53 UTC] jurigag at gmail dot com
[2021-02-12 15:58 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
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" } }