framework icon indicating copy to clipboard operation
framework copied to clipboard

The array_first helper function breaks in PHP =< 8.3

Open erikverbeek opened this issue 3 months ago • 15 comments

Laravel Version

11 / 12

PHP Version

8.3.13

Database Driver & Version

No response

Description

Hello all,

The following pull request was merged yesterday: Prevent infinite loop on array_first, array_last, str_contains.

This fix uses the function array_find_key, which was introduced in PHP 8.4. This results in an Call to undefined function array_find_key error on our systems which are still running on 8.3.

Steps To Reproduce

Run the following code in PHP 8.3

 array_first([
   'en' => 'English',
   'nl' => 'Dutch',
   'it' => 'Italian',
   'fr' => 'French'
   ], fn($language, $languageCode) => $languageCode === 'nl');

erikverbeek avatar Sep 02 '25 09:09 erikverbeek