Bug #68057 [Com]: Incorrect parsing of big arrays in PHP 5.6.0
| From: | vostreltsov at gmail dot com | Date: | Fri, 14 Nov 2014 08:18:26 +0000 |
| Subject: | Bug #68057 [Com]: Incorrect parsing of big arrays in PHP 5.6.0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188589@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68057&edit=1
ID: 68057
Comment by: vostreltsov at gmail dot com
Reported by: vostreltsov at gmail dot com
Summary: Incorrect parsing of big arrays in PHP 5.6.0
Status: Assigned
Type: Bug
Package: Arrays related
Operating System: Linux
PHP Version: 5.6.0
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
Any progress on this issue? Changing ushort to uint looks easy to do.
Previous Comments:
------------------------------------------------------------------------
[2014-09-19 18:55:10] nikic@php.net
Constant expression AST uses ushort child count in 5.6, which is overflowing here.
------------------------------------------------------------------------
[2014-09-19 18:45:28] mamontov dot dp at gmail dot com
Confirmed in Windows 8, using x86 non-thread-safe build.
------------------------------------------------------------------------
[2014-09-19 18:25:14] vostreltsov at gmail dot com
Forgot to mention that the problem appeared after upgrading from 5.5.X (don't remember the
exact version) to 5.6.0.
------------------------------------------------------------------------
[2014-09-19 18:20:54] vostreltsov at gmail dot com
Description:
------------
So in my project I have an auto-generated lexer, it contains a big array. I created a simplified
script that reproduces the bug.
There are 65538 integers and it looks like something overflows inside PHP. The var_dump call ouputs
an array of only the last 2 numbers.
Removing last 2 numbers yields an empty array.
If I remove last 3 numbers, the output stops at key 32766, that is 32767 values.
Test script:
---------------
http://filebin.ca/1atoDItGZU2A
Expected result:
----------------
All of 65538 integers
Actual result:
--------------
array(2) {
[0]=>
int(0)
[1]=>
int(0)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68057&edit=1