Hi,

I am new to VS Code and recently started using it. After installing the PHP extension I am getting the above error message in every instance of using 'array_multisort'. I don't think there is anything wrong in what I am doing as it works fine. Here is the code:

array_multisort(array_column($userlist, 0), SORT_ASC, array_column($userlist, 1), SORT_ASC, $userlist);

Please advise if there is problem in the analysis being done by the extension, or am I actually doing something wrong?

Thanks for any help!

    PawanAhluwalia hello, and thank you for reporting the issue.

    I think it may be problem on our side. I'll try to fix it within the next update.

      I ran into this as well because the first parameter of array_multisort is indeed a pass by reference parameter. Technically all of the arrays are from what I can see of how array_multisort works. That said, the snippet in OP is valid to PHP, and I use a similar valid approach that also gets this error from the PHP extension: array_multisort(array_map(fn($item) => $item->getLabel(), $items), SORT_ASC, array_map(...

        It's a very specific case of array_multisort(), where the documentation says, that the parameter is passed by reference but it doesn't say it's "optional" reference.

        I'll update our built-in manual accordingly, so we won't treat it as a reference.

        Write a Reply...