php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17580 PARSE_INI_FILE exits on files larger than 16KB
Submitted: 2002-06-03 12:51 UTC Modified: 2002-10-14 18:52 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:2 (50.0%)
From: jorg dot zimmermann at ron dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.1/4.3.0 OS: windows NT 4.0/XP/2000
Private report: No CVE-ID:
 [2002-06-03 12:51 UTC] jorg dot zimmermann at ron dot de
When I use parse_ini_file() on files larger then 16KB (exact 16382 Bytes) it exits with "input buffer overflow, can't enlarge buffer because scanner uses REJECT" there is no entry in the errorlog

<?
$ini = parse_ini_file("myini.ini");
print_r($ini);
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-03 13:13 UTC] sander@php.net
AFAIK this error only appears if you have more than x kB (apparently 16) on one line. Because that's not a strict limitation at all, I'm closing this one.
If you think this is not correct, please reopen this report.
 [2002-06-03 18:19 UTC] jorg dot zimmermann at ron dot de
this is not the case,
it is standard windows ini file format.
[xxx]
key1=data
key2=data
.
.
.
 [2002-06-03 18:26 UTC] jorg dot zimmermann at ron dot de
sorry this is not the case,
it is standard windows ini file format.
[xxx]
key1=data
key2=data
.
.
.

and i do get a regular array on files <16k
there is a \r\n at the end of each line
 [2002-06-03 18:31 UTC] mfischer@php.net
confirmed, just create a testfile with zillions of key=data entries, you will hit the limit somewhen.

Seems to be dependant on the flex code for ini scanner in Zend. Is it really worth the trouble ... ?
 [2002-06-03 18:41 UTC] jorg dot zimmermann at ron dot de
not a zillion, :) you can hit this limit with barely 300 keys and 55 char per line ...
 [2002-06-10 15:08 UTC] alex at acid-edge dot net
Trying to parse Winamp .pls files and had to rely on a dodgy class someone wrote - however I don't get any error, PHP just seems to exit with no warning :/
 [2002-08-28 20:24 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

I cannot replicate this bug on windows XP or linux, while using an ini file just under 100kb with 1000 keys.
 [2002-09-09 13:34 UTC] jorg dot zimmermann at ron dot de
tried this:
<?
$file = "myini.ini";
$fp = fopen($file,"a+");
fwrite($fp,"[TEXT]");
for ($i = 1; $i< 1000; $i++) fwrite($fp,"\r\nxx_".$i."=This is a test for the parseini function line ".$i);
fclose($fp);
$ini = parse_ini_file($file);
print_r($ini);
?>
with:
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

= PHP 4.3.0
as suggested from iliaa@php.net 
on win XP
it creates a file 57732 bytes and 999 keys

still get same 'error'
"input buffer overflow, can't enlarge buffer because scanner uses REJECT"
 [2002-09-09 17:18 UTC] sniper@php.net
Same results also on Linux, using latest PHP 4.3.0-dev.

 [2002-10-02 04:25 UTC] devon at NOSPAMsitetronics dot com
This is also apparent in FBSD 4.7-RC using 4.3.0-dev, I'm looking at the scanner.
 [2002-10-14 18:52 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 19:01:53 2014 UTC