#44574 [Fbk->Opn]: parse_ini_file eof problem
| From: | letssurf at gmail dot com | Date: | Wed, 02 Apr 2008 10:21:48 +0000 |
| Subject: | #44574 [Fbk->Opn]: parse_ini_file eof problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123860@lists.php.net to get a copy of this message | ||
ID: 44574
User updated by: letssurf at gmail dot com
Reported By: letssurf at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: Linux 2.6.9-34
PHP Version: 5.3CVS-2008-03-31 (snap)
Assigned To: fb-req-jani
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2008-04-02 09:36:12] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.3-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.3-win32-installer-latest.msi
I can't reproduce this. Try more recent snapshot.
------------------------------------------------------------------------
[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