polyfilled). * @throws InvalidArgumentException If `$min` is greater than `$max`, or if `$min` or `$max` is NAN, and the ValueError class does not exist (PHP 7.x). * * @phpstan-template TValue * @phpstan-template TMin * @phpstan-template TMax * @phpstan-param TValue $value * @phpstan-param TMin $min * @phpstan-param TMax $max * @phpstan-return TValue|TMin|TMax */ function clamp( $value, $min, $max ) { $throw_value_error = static function ( string $message ) { // The ValueError class was introduced in PHP 8, so in 7.4 throw InvalidArgumentException instead. if ( ! class_exists( 'ValueError', false ) ) { throw new InvalidArgumentException( $message ); } throw new ValueError( $message ); }; if ( is_float( $min ) && is_nan( $min ) ) { $throw_value_error( 'clamp(): Argument #2 ($min) must not be NAN' ); } if ( is_float( $max ) && is_nan( $max ) ) { $throw_value_error( 'clamp(): Argument #3 ($max) must not be NAN' ); } if ( $max < $min ) { $throw_value_error( 'clamp(): Argument #2 ($min) must be smaller than or equal to argument #3 ($max)' ); } /* * The upper bound is checked before the lower bound to match the order in PHP's * implementation. Comparison in PHP is not transitive when operands of different * types are mixed (for example, comparing against a bool coerces both operands to * bool), so both bounds can compare as exceeded at once, and the first check wins. */ if ( $value > $max ) { return $max; } if ( $value < $min ) { return $min; } return $value; } } // IMAGETYPE_AVIF constant is only defined in PHP 8.x or later. if ( ! defined( 'IMAGETYPE_AVIF' ) ) { define( 'IMAGETYPE_AVIF', 19 ); } // IMG_AVIF constant is only defined in PHP 8.x or later. if ( ! defined( 'IMG_AVIF' ) ) { define( 'IMG_AVIF', IMAGETYPE_AVIF ); } // IMAGETYPE_HEIF constant is only defined in PHP 8.5 or later. if ( ! defined( 'IMAGETYPE_HEIF' ) ) { define( 'IMAGETYPE_HEIF', 20 ); }
Fatal error: Uncaught Error: Call to undefined function str_contains() in /home/he2a35ddd308f/public_html/wp-includes/load.php:1691 Stack trace: #0 /home/he2a35ddd308f/public_html/wp-includes/default-constants.php(43): wp_convert_hr_to_bytes('512m') #1 /home/he2a35ddd308f/public_html/wp-settings.php(66): wp_initial_constants() #2 /home/he2a35ddd308f/public_html/wp-config.php(75): require_once('/home/he2a35ddd...') #3 /home/he2a35ddd308f/public_html/wp-load.php(50): require_once('/home/he2a35ddd...') #4 /home/he2a35ddd308f/public_html/wp-blog-header.php(13): require_once('/home/he2a35ddd...') #5 /home/he2a35ddd308f/public_html/index.php(17): require('/home/he2a35ddd...') #6 {main} thrown in /home/he2a35ddd308f/public_html/wp-includes/load.php on line 1691