#26584 [Com]: Class member - array key overflow

From: Date: Thu, 11 Dec 2003 15:16:16 +0000
Subject: #26584 [Com]: Class member - array key overflow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51953@lists.php.net to get a copy of this message
ID: 26584 Comment by: bartek-no-uce at bulzak dot com Reported By: sean@php.net Status: Verified Bug Type: Class/Object related Operating System: Linux 2.4.22 i686 PHP Version: 4CVS, 5CVS New Comment: It gets even more interesting. Seems like array() doesn't behave the same way wheter or not it's being called from within an object, but if you do a direct array assignment (brakets) everything goes back to normal. source: http://dev.rdesol.com/helo/class_array_bug.phps running code: http://dev.rdesol.com/helo/class_array_bug.php Bartek Bulzak Previous Comments: ------------------------------------------------------------------------ [2003-12-10 10:04:35] sean@php.net Description: ------------ See attached code. It seems that when assigning arrays in a class definition, it's possible to overflow the array key, without any sort of warning/notice/etc. This only happens in a class def, and not to a "global" namespace array. It's odd that the same code isn't used for both regular array constructs, and object array constructs (Zend Engine). ZE2 may fix this problem. Has not been tested. The logical overflow threshold is between 2147483647 and 2147483648 (where 2147483648 is a 32bit (singed) integer value of -0, if I'm not mistaken -- or 0x80000000). Note: this affects more than just negative keys as seen in code:VAL3. I don't have time to jump into the php source right now (nor am I truly qualified to do so). Please let me know if/when you need additional details. S (sean@php.net) Reproduce code: --------------- http://sean.caedmon.net/php/class_array_bug.phps (http://sean.caedmon.net/php/class_array_bug.php) Expected result: ---------------- (see code) Actual result: -------------- (see code) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26584&edit=1

« previous php.bugs (#51953) next »