ID: 45384 Comment by: mats dot lindh at gmail dot com Reported By: [EMAIL PROTECTED] Status: Critical Bug Type: Filesystem function related Operating System: Ubuntu PHP Version: 5.3CVS-2008-06-28 (CVS) New Comment:
The fix to #45372 did not fix this issue, the problem is still in both the PHP5_3 and HEAD branches. Previous Comments: ------------------------------------------------------------------------ [2008-06-29 00:50:26] [EMAIL PROTECTED] $ echo -n "foo.bar = baz " > test.ini 20:46 [EMAIL PROTECTED]:~ $ /opt/php53/bin/php -r 'var_dump(parse_ini_file("test.ini"));' array(1) { ["foo.bar"]=> string(4) "baz " } so the answer is, yes, a trailing space does not cause the error...if this needs to be marked as a duplicate, whatever it takes to get this working the same as php<=5.2 ------------------------------------------------------------------------ [2008-06-28 11:22:11] [EMAIL PROTECTED] This is probably also related to the re2c/YYFILL() scanner issues I described in Bug #45372. I assume it's because a variable length rule is matching ("baz" in your example) when it hits EOF and YYFILL() causes a return/abort. This (unexpected $end) is more likely to happen with ini parsing, etc. where it doesn't usually happen with VALID code in a PHP script because the last thing matched in a typical file is with a fixed length rule (e.g. "?>" or ";"), and these things only happen with variable length matches as I explained in the other bug, though they shouldn't with working scanner code, IMO. BTW, does putting a space or something other than a newline after baz allow it to work? Any character that's not allowed in the rule matching baz should also make it "magically" work. :-) ------------------------------------------------------------------------ [2008-06-28 03:05:49] [EMAIL PROTECTED] Description: ------------ an ini file with no trailing newline will result in "Parse error", php5.3 only, 5.2 parses the file fine Reproduce code: --------------- $ echo -n "foo.bar = baz" > test.ini $ /opt/php53/bin/php -r 'var_dump(parse_ini_file("test.ini"));' Expected result: ---------------- array(1) { ["foo.bar"]=> string(3) "baz" } Actual result: -------------- Warning: syntax error, unexpected $end in test.ini on line 1 in Command line code on line 1 Call Stack: 0.0003 312916 1. {main}() Command line code:0 0.0128 312936 2. parse_ini_file() Command line code:1 array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45384&edit=1