[php-src] Issue #24254: array_combine() converts boolean false keys to empty strings instead of integer keys

From: Date: Sun, 11 Oct 2026 08:06:22 +0000
Subject: [php-src] Issue #24254: array_combine() converts boolean false keys to empty strings instead of integer keys
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252969@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/24254 Author: arshidkv12 ### Description array_combine() converts a boolean false key to an empty string ("") instead of integer key 0, unlike normal PHP array-key conversion behavior. **Code to reproduce** ```php <?php var_dump(array_combine([true, false], ['true', 'false'])); ``` **Actual output** ```text array(2) { [1]=> string(4) "true" [""]=> string(5) "false" } ``` **Expected output** ```text array(2) { [1]=> string(4) "true" [0]=> string(5) "false" } ``` **Affected versions:** PHP 8.4.x, PHP 8.5.x, PHP 8.6.x, and PHP 8.7.x (please verify each version). **Additional information** Direct array construction converts boolean keys to integers: ```php var_dump([true => 'true', false => 'false']); ``` This suggests that array_combine() may be converting boolean keys to strings rather than applying the usual PHP array-key conversion rules. ### PHP Version ```plain PHP 8.4.26-dev (cli) (built: Oct 11 2026 12:44:08) (NTS DEBUG) Copyright (c) The PHP Group Zend Engine v4.4.26-dev, Copyright (c) Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#252969) next »