ID: 44574
Updated by: [EMAIL PROTECTED]
Reported By: letssurf at gmail dot com
Status: Assigned
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:
Added this missing case to
ext/standard/tests/general_funcs/parse_ini_file.phpt.
Previous Comments:
------------------------------------------------------------------------
[2008-04-02 10:25:05] [EMAIL PROTECTED]
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