[php-src] Issue #11787: var_dump() output incorrect

From: Date: Tue, 25 Jul 2023 13:48:45 +0000
Subject: [php-src] Issue #11787: var_dump() output incorrect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245031@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11787 Author: flobee ### Description The following code: ```php <?php $options = array( '-0' => 'val: -0', '-1', '-2' => 'val: -2', 'other', 'o' => 'other', ); ``` Resulted in this output: ``` array(5) { ["-0"]=> string(7) "val: -0" [0]=> string(2) "-1" [-2]=> string(7) "val: -2" [1]=> string(5) "other" ["o"]=> string(5) "other" } ``` But I expected this output instead: ``` array(5) { ["-0"]=> --^^^^-------------------------------------- correct string(7) "val: -0" ["-1"]=> --^^^^-------------------------------------- fail: int 0, correct: "-1" expected string(2) "-1" ["-2"]=> --^^^^-------------------------------------- fail: int -2, correct ["-2"] expected string(7) "val: -2" [1]=> string(5) "other" ["o"]=> string(5) "other" } ``` OS: Debian Buster, Tested with php8.0, 8.1, 8.2, 5.6, 7.0, 7.3,7.4 (packages from sury) All the same result. ### PHP Version 8.0.29 ### Operating System Debian Buster

« previous php.bugs (#245031) next »