php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51061 array keys with huge ints failing
Submitted: 2010-02-16 20:49 UTC Modified: 2010-02-17 16:35 UTC
From: seanius at debian dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.1 OS: Debian
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: seanius at debian dot org
New email:
PHP Version: OS:

 

 [2010-02-16 20:49 UTC] seanius at debian dot org
Description:
------------
found in the debian build, but i can reproduce it on an pristine snapshot.  see also: #45877, #48254 for background, though these are reported as fixed (regression maybe?).

it seems that the last array item is being ignored instead of being converted into a string key.

rangda[/home/sean/Download/php5.3-201002160730] ./run-tests.php --show-all -p ./sapi/cli/php ./Zend/tests/bug45877.phpt

=====================================================================
PHP         : ./sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.3-dev
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux rangda 2.6.32-trunk-amd64 #1 SMP Sun Jan 10 22:40:40 UTC 2010 x86_64
INI actual  : /home/sean/Download/php5.3-201002160730
More .INIs  :  
CWD         : /home/sean/Download/php5.3-201002160730
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
Running selected tests.
TEST 1/1 [Zend/tests/bug45877.phpt]
========TEST========
<?php
$keys = array(PHP_INT_MAX,
	(string) PHP_INT_MAX,
	(string) (-PHP_INT_MAX - 1),
	-PHP_INT_MAX - 1,
	(string) (PHP_INT_MAX + 1));

var_dump(array_fill_keys($keys, 1));
?>
========DONE========

========OUT========
array(2) {
  [9223372036854775807]=>
  int(1)
  [-9223372036854775808]=>
  int(1)
}
========DONE========

========EXP========
array(3) {
  [%d7]=>
  int(1)
  [-%d8]=>
  int(1)
  ["%d8"]=>
  int(1)
}
========DONE========

========DIFF========
001+ array(2) {
001- array(3) {
006-   ["%d8"]=>
007-   int(1)
========DONE========
FAIL Bug #45877 (Array key '2147483647' left as string) [Zend/tests/bug45877.phpt] 
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #45877 (Array key '2147483647' left as string) [Zend/tests/bug45877.phpt]
=====================================================================


Reproduce code:
---------------
./Zend/tests/bug45877.phpt

Expected result:
----------------
PASS

Actual result:
--------------
FAIL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-16 20:51 UTC] seanius at debian dot org
fwiw this is tested on amd64, though i see the failure on both big/little endian machines and 32/64bit machines.
 [2010-02-17 07:30 UTC] jani@php.net
Same as bug #51008 (don't you debian guys coordinate this at all? :)
 [2010-02-17 16:35 UTC] seanius at debian dot org
ah, indeed, this is a duplicate.  looks like some wires got crossed about who was going to report what--we hadn't been tracking that on our end but i'll make sure that we do before i throw anything else your way.  sorry for the noise.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 03:01:31 2025 UTC