[wp-trac] [WordPress Trac] #63853: Add PHP 8.5 compat array functions: `array_first` and `array_last`
WordPress Trac
noreply at wordpress.org
Thu Aug 21 02:32:59 UTC 2025
#63853: Add PHP 8.5 compat array functions: `array_first` and `array_last`
-------------------------------+--------------------------------
Reporter: TobiasBg | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.9
Component: General | Version:
Severity: normal | Resolution:
Keywords: needs-patch php85 | Focuses: php-compatibility
-------------------------------+--------------------------------
Comment (by tusharbharti):
Hi, I am interested in creating a compat for `array_first` and
`array_last` but would like to confirm how the function should handle
following cases:
- If the values are empty-ish like null, 0 , false etc, should the
function return null ( by allowing empty-ish value to be passed ) or throw
error when trying to access the key for these.
- If any error occurs while trying to get the first/last key of the array
or trying to get the value from the array, should the function handle
these errors or this is left for consumers to handle.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63853#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list