[php-src] Issue #14873: PHP 8.4 min function fails on typed integer

From: Date: Mon, 08 Jul 2024 12:18:32 +0000
Subject: [php-src] Issue #14873: PHP 8.4 min function fails on typed integer
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247250@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14873 Author: Alkarex ### Description Hello, The min() function seems to fail (returns null) on a typed integer, but only in specific situations and environments. Notes: 1. It fails when called from Apache module php84-apache2 (i.e. from a Web browser) but not when called from CLI (command line). 2. It fails with a typed int parameter (function testMin(int $value)) but not on untyped parameter (function testMin($value)). The following code: ```php <?php function testMin(int $value): int { $value = min($value, 100); return $value; } echo testMin(5); ``` Resulted in this output: ``` PHP Fatal error: Uncaught TypeError: testMin(): Return value must be of type int, null returned in ./test-min.php:5 Stack trace: #0 ./test-min.php(8): testMin() #1 {main} thrown in ./test-min.php on line 5 ``` But I expected this output instead: ``` 5 ``` System information: ```console # cat /etc/issue Welcome to Alpine Linux 3.21.0_alpha20240606 (edge) Kernel \r on an \m (\l) # php -v PHP 8.4.0alpha1 (cli) (built: Jul 4 2024 10:02:18) (NTS) Copyright (c) The PHP Group Zend Engine v4.4.0-dev, Copyright (c) Zend Technologies with Zend OPcache v8.4.0alpha1, Copyright (c), by Zend Technologies ``` ### PHP Version PHP 8.4.0alpha1 ### Operating System Alpine Linux 3.21.0_alpha20240606 (edge)

« previous php.bugs (#247250) next »