Bug #76589 [NEW]: array_column should error when value is not castable to array key

From: Date: Fri, 06 Jul 2018 14:17:36 +0000
Subject: Bug #76589 [NEW]: array_column should error when value is not castable to array key
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216174@lists.php.net to get a copy of this message
From: nobots dot nospam at example dot org Operating system: PHP version: 7.3.0alpha3 Package: Arrays related Bug Type: Bug Bug description:array_column should error when value is not castable to array key Description: ------------ array_column should error when value is not castable to array key without loss of data $a = [ [ 'foo' => 777.5 ], ]; array_column($a, 'foo', 'foo'); is an error because float cannot be used as array key ------------ also it should error if the index already exists and is being overwritten $a = [ [ 'foo' => 777, "hi" => 1 ], [ 'foo' => 777, "hi" => 2 ], ]; the index 777 is written twice and the original value is lost ------------ and this is certainly a bug https://3v4l.org/WhUmh -- Edit bug report at https://bugs.php.net/bug.php?id=76589&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76589&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76589&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76589&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76589&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76589&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76589&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76589&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76589&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76589&r=support Expected behavior: https://bugs.php.net/fix.php?id=76589&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76589&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76589&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76589&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76589&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76589&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76589&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76589&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76589&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76589&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76589&r=mysqlcfg

« previous php.bugs (#216174) next »