php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43949 Incorrect index in arrays
Submitted: 2008-01-27 22:47 UTC Modified: 2008-01-27 23:04 UTC
From: fataluk1 at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows XP ( SP 2 ( not sure ))
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fataluk1 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-01-27 22:47 UTC] fataluk1 at gmail dot com
Description:
------------
Just see the code.

Reproduce code:
---------------
<?php
$someNum=5776545345436;
echo($someNum."<br>");//output the correct num
$arr=Array($someNum=>'a');
$keys=array_keys($arr);
echo($keys[0]);
?>

Expected result:
----------------
5776545345436
5776545345436

Actual result:
--------------
5776545345436
-185667684

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-27 23:04 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The large integer is converted to float at moment:
echo($someNum."<br>");

And as array keys should be only integer or string, it isn't converted, then the large integer is converted to the integer limit.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 25 08:00:01 2025 UTC