Bug #72991 [Fbk->Csd]: Wrong key in array

From: Date: Thu, 01 Sep 2016 09:41:36 +0000
Subject: Bug #72991 [Fbk->Csd]: Wrong key in array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203720@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72991&edit=1 ID: 72991 User updated by: dimice at dimice dot ru Reported by: dimice at dimice dot ru Summary: Wrong key in array -Status: Feedback +Status: Closed Type: Bug Package: *General Issues Operating System: Windows 10 x64 PHP Version: 7.0.10 Block user comment: N Private report: N New Comment: Issue with xdebug. Previous Comments: ------------------------------------------------------------------------ [2016-09-01 09:41:10] dimice at dimice dot ru Seems works good with xdebug disabled. ------------------------------------------------------------------------ [2016-09-01 09:36:29] nikic@php.net Please try this with xdebug disabled. ------------------------------------------------------------------------ [2016-09-01 09:25:49] dimice at dimice dot ru Description: ------------ Sample code: in PHP 5.5: MAX_INT = 2147483647 730022509303030 cast to int => -1671932682, it's OK 730022509303030 key in array => -1671932682, it's OK in PHP 7.0: MAX_INT = 9223372036854775807 730022509303030 cast to int => 730022509303030, it's OK 730022509303030 key in array => -1671932682, WHY!? See test script. Test script: --------------- <?php $ar = array(); $id = (int)730022509303030; $ar[$id] = "test"; var_dump($id); var_dump($ar); ?> Expected result: ---------------- int 730022509303030 array (size=1) 730022509303030 => string 'test' (length=4) Actual result: -------------- int 730022509303030 array (size=1) -1671932682 => string 'test' (length=4) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72991&edit=1

« previous php.bugs (#203720) next »