Bug #79921 [Asn]: memory exhausted, on array definition, in require

From: Date: Sat, 01 Aug 2020 21:43:51 +0000
Subject: Bug #79921 [Asn]: memory exhausted, on array definition, in require
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228362@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79921&edit=1 ID: 79921 User updated by: chandleg at wizardsworks dot org Reported by: chandleg at wizardsworks dot org Summary: memory exhausted, on array definition, in require Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Slackware Linux PHP Version: 7.2.32 Assigned To: cmb Block user comment: N Private report: N New Comment: Alternatively I can also post the code used to generate the file itself. Previous Comments: ------------------------------------------------------------------------ [2020-08-01 21:42:24] chandleg at wizardsworks dot org I genuinely don't know. Of all the machines I have this one has the latest version of PHP installed. I can drop the config file in a place to test, if someone who does have a machine laying around with a newer version installed wants to try. ------------------------------------------------------------------------ [2020-08-01 15:22:19] cmb@php.net Does that also happen with any of the actively supported PHP versions[1]? [1] <https://www.php.net/supported-versions.php> ------------------------------------------------------------------------ [2020-08-01 08:28:11] chandleg at wizardsworks dot org I meant to mention the array format is variable array of: array(int, int, int, float, array, array, array) Where each 3rd level array is of 1-3 elements, but the same number of elements of the other arrays in the 2nd level. Also the 100006 line file is 1.2Meg. It appears to be running out of stack/heap trying to load it, but I thought that arrays in PHP were unlimited size, the best calculation I have on this, is it should be around 22Meg in memory. It's tossing "memory exhausted" in the parser, not in the running, so I'm wondering what the limit for either a require, or an array is. I am fairly certain I have function files I include larger than 10,000 lines, and I am extremely certain I have arrays with element counts over 300,000. ------------------------------------------------------------------------ [2020-08-01 08:21:44] chandleg at wizardsworks dot org Description: ------------ I have a 10006 line "config" file, which is an array set for data values. The format is: array(int, int, int, float, array, array, array) Exerpt: <?php $star_map = array ( array(-587, 418, -182, 849.85998846869, array(2, 2), array(5.96541E+29, 5.96541E+29), array(278538822.144, 278538822.144), array(-949, 457, -877, 1603.2251869279, array(2, 2), array(5.96541E+29, 5.96541E+29), array(278538822.144, 278538822.144), array(1087, -401, 144, 1543.9799221492, array(2, 2), array(5.96541E+29, 5.96541E+29), array(278538822.144, 278538822.144), ........ array(-685, 113, -82, 972.20059658488, array(2), array(5.96541E+29), array(278538822.144), array(554, 244, -57, 785.54503371863, array(2, 2), array(5.96541E+29, 5.96541E+29), array(278538822.144, 278538822.144), array(1022, -77, -865, 1684.3969247182, array(2, 2), array(5.96541E+29, 5.96541E+29), array(278538822.144, 278538822.144), ); ?> Test script: --------------- <?php require "./config.php"; ?> Expected result: ---------------- I would expect it to properly import the inline code. Actual result: -------------- redacted:~/public_html/game/tmp$ php index.php PHP Parse error: memory exhausted in ./chart.php on line 2500 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79921&edit=1

« previous php.bugs (#228362) next »