php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51899 Parse error in parse_ini_file() function when empy value followed by no newline
Submitted: 2010-05-24 15:36 UTC Modified: 2010-05-26 04:18 UTC
From: aigors at inbox dot lv Assigned: felipe (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.3.2 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aigors at inbox dot lv
New email:
PHP Version: OS:

 

 [2010-05-24 15:36 UTC] aigors at inbox dot lv
Description:
------------
The function parse_ini_file raises "PHP Warning:  syntax error, unexpected $end" when ini file has empty last value assignment with no new line after it:

parse_ini_file.ini
a=4
b=

(no new line after the 2nd line).

Test script:
---------------
$data = parse_ini_file('parse_ini_file.ini');
print_r($data);

Expected result:
----------------
Array
(
    [a] => 4
    [b] =>
)

Actual result:
--------------
PHP Warning:  syntax error, unexpected $end in parse_ini_file.ini on line 2
 in C:\work\parse_ini_file.php on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-26 04:18 UTC] felipe@php.net
-Summary: Parse error in parse_ini_file function +Summary: Parse error in parse_ini_file() function when empy value followed by no newline -Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-05-26 04:18 UTC] felipe@php.net
This bug has been fixed in SVN.

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.


 [2010-05-26 04:18 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=299767
Log: - Fixed bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:30 2024 UTC