Make WordPress Core


Ignore:
Timestamp:
01/09/2026 11:45:46 AM (9 months ago)
Author:
johnbillion
Message:

General: Increase the minimum supported version of PHP to 7.4.

Props justlevine, masteradhoc, samiamnot, matt, bradshawtm, 4thhubbard, desrosj, jorbin, westonruter, peterwilsoncc, johnbillion

Fixes #62622

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/compat.php

    r61328 r61459  
    297297endif;
    298298
    299 // sodium_crypto_box() was introduced in PHP 7.2.
     299// sodium_crypto_box() was introduced with Sodium in PHP 7.2, but the extension may not be enabled.
    300300if ( ! function_exists( 'sodium_crypto_box' ) ) {
    301301        require ABSPATH . WPINC . '/sodium_compat/autoload.php';
    302 }
    303 
    304 if ( ! function_exists( 'is_countable' ) ) {
    305         /**
    306          * Polyfill for is_countable() function added in PHP 7.3.
    307          *
    308          * Verify that the content of a variable is an array or an object
    309          * implementing the Countable interface.
    310          *
    311          * @since 4.9.6
    312          *
    313          * @param mixed $value The value to check.
    314          * @return bool True if `$value` is countable, false otherwise.
    315          */
    316         function is_countable( $value ) {
    317                 return ( is_array( $value )
    318                         || $value instanceof Countable
    319                         || $value instanceof SimpleXMLElement
    320                         || $value instanceof ResourceBundle
    321                 );
    322         }
    323 }
    324 
    325 if ( ! function_exists( 'array_key_first' ) ) {
    326         /**
    327          * Polyfill for array_key_first() function added in PHP 7.3.
    328          *
    329          * Get the first key of the given array without affecting
    330          * the internal array pointer.
    331          *
    332          * @since 5.9.0
    333          *
    334          * @param array $array An array.
    335          * @return string|int|null The first key of array if the array
    336          *                         is not empty; `null` otherwise.
    337          */
    338         function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
    339                 if ( empty( $array ) ) {
    340                         return null;
    341                 }
    342 
    343                 foreach ( $array as $key => $value ) {
    344                         return $key;
    345                 }
    346         }
    347 }
    348 
    349 if ( ! function_exists( 'array_key_last' ) ) {
    350         /**
    351          * Polyfill for `array_key_last()` function added in PHP 7.3.
    352          *
    353          * Get the last key of the given array without affecting the
    354          * internal array pointer.
    355          *
    356          * @since 5.9.0
    357          *
    358          * @param array $array An array.
    359          * @return string|int|null The last key of array if the array
    360          *.                        is not empty; `null` otherwise.
    361          */
    362         function array_key_last( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
    363                 if ( empty( $array ) ) {
    364                         return null;
    365                 }
    366 
    367                 end( $array );
    368 
    369                 return key( $array );
    370         }
    371302}
    372303
Note: See TracChangeset for help on using the changeset viewer.