Bug #76385 [Com]: Value of PHP_INT_MIN cannot be used as default value for int parameter

From: Date: Tue, 29 May 2018 06:44:10 +0000
Subject: Bug #76385 [Com]: Value of PHP_INT_MIN cannot be used as default value for int parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215402@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76385&edit=1 ID: 76385 Comment by: gooh@php.net Reported by: sebastian@php.net Summary: Value of PHP_INT_MIN cannot be used as default value for int parameter Status: Open Type: Bug Package: Scripting Engine problem Operating System: Irrelevant PHP Version: 7.2.6 Block user comment: N Private report: N New Comment: The value of PHP_INT_MIN (but not of PHP_INT_MAX) is a float apparently. You can use function f(int $i = PHP_INT_MIN) {} as a workaround. Previous Comments: ------------------------------------------------------------------------ [2018-05-29 06:26:16] sebastian@php.net It appears that the value of PHP_INT_MIN is generally not recognized as being an integer value: $ cat a.php <?php var_dump(PHP_INT_MIN); var_dump(is_int(-9223372036854775808)); $ php -n a.php int(-9223372036854775808) bool(false) ------------------------------------------------------------------------ [2018-05-29 06:16:24] sebastian@php.net Description: ------------ $ cat a.php <?php var_dump(PHP_INT_MIN); $ cat b.php <?php function f(int $i = -9223372036854775808) { } $ php -nv PHP 7.2.6 (cli) (built: May 22 2018 16:22:08) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies $ php -n a.php int(-9223372036854775808) $ php -n b.php Fatal error: Default value for parameters with a integer type can only be integer or NULL in /home/sb/b.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76385&edit=1

« previous php.bugs (#215402) next »