#44574 [Asn->Csd]: parse_ini_file eof problem
| From: | lbarnaud@php.net | Date: | Sun, 17 Aug 2008 21:37:16 +0000 |
| Subject: | #44574 [Asn->Csd]: parse_ini_file eof problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-128158@lists.php.net to get a copy of this message | ||
ID: 44574
Updated by: lbarnaud@php.net
Reported By: letssurf at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Filesystem function related
Operating System: Linux 2.6.9-34
PHP Version: 5.3CVS-2008-03-31 (snap)
Assigned To: helly
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-04-08 12:40:38] jani@php.net
Added this missing case to
ext/standard/tests/general_funcs/parse_ini_file.phpt.
------------------------------------------------------------------------
[2008-04-02 10:25:05] jani@php.net
Apparently the transition from flex -> re2c caused this since I can't
reproduce this with php build made prior that. Marcus..?
------------------------------------------------------------------------
[2008-04-02 10:21:48] letssurf at gmail dot com
Retested with builds
Win32 build Apr 2 2008 04:17:01, same problem
Linux built php5.3-200804020830, same problem
-- file: test1.php --
<?php
$filename = dirname(__FILE__).'/test.ini';
$data = "[section1]\nname = value";
file_put_contents($filename, $data);
$ini = parse_ini_file($filename, true);
print_r($ini);
-- file: test2.php --
<?php
$filename = dirname(__FILE__).'/test.ini';
$data = "[section1]\nname = value\n";
file_put_contents($filename, $data);
$ini = parse_ini_file($filename, true);
print_r($ini);
--
test1.php doesn't work gives an error Warning: syntax error, unexpected
$end in test.ini on line 2
in test1.php on line 7
test2.php works no problem
------------------------------------------------------------------------
[2008-03-31 09:24:18] letssurf at gmail dot com
Description:
------------
parse_ini_file doesn't see the EOF as a delimiter for ini entries.
Reproduce code:
---------------
-- file: config.ini --
[section1]
name = value <<< EOF here, no new line
-- file: test.php --
<?php
$ini = parse_ini_file('config.ini', true);
print_r($ini);
Expected result:
----------------
Array ( [section1] => Array ( [name] => value ) )
Actual result:
--------------
Warning: syntax error, unexpected $end in eof.ini on line 2 in test.php
on line 2
Array ( [section1] => Array ( ) )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44574&edit=1