#44609 [Asn->Csd]: parse_ini_file 'dollar'-sign problems

From: Date: Mon, 07 Apr 2008 11:39:59 +0000
Subject: #44609 [Asn->Csd]: parse_ini_file 'dollar'-sign problems
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124034@lists.php.net to get a copy of this message
 ID:               44609
 Updated by:       scottmac@php.net
 Reported By:      sander at procurios dot nl
-Status:           Assigned
+Status:           Closed
 Bug Type:         Filesystem function related
 Operating System: Mac OS X
 PHP Version:      5.3CVS-2008-04-02 (snap)
-Assigned To:      helly
+Assigned To:      scottmac
 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-03 14:04:59] scottmac@php.net

The comment was towards Jani rather than yourself.

It will be changed, I'm just not sure what was originally intended.

------------------------------------------------------------------------

[2008-04-03 13:49:29] sander at procurios dot nl

I am not sure I understand what you are saying. Are you telling me that
we are no longer allowed to use "$4" (or anything else that matches your
pattern) in our INI files? That would be a major change, since the
"Expected result" I posted was output that I got from executing the
exact same code on PHP 5.2.5

------------------------------------------------------------------------

[2008-04-03 13:29:19] scottmac@php.net

I did the ini changes and the syntax is the same as before apart from
adding null to the disallowed characters.

LITERAL_DOLLAR ("$"([^a-zA-Z0-9{\000]|("\\"{ANY_CHAR})))

So $4 is what is invalid in the test.

------------------------------------------------------------------------

[2008-04-03 11:14:43] jani@php.net

Marcus, another "works before re2c" bug.

------------------------------------------------------------------------

[2008-04-02 12:32:51] sander at procurios dot nl

Description:
------------
Parse_ini_file gives a syntax error on 'dollar'-sign in INI-file.

Source: php5.3-200804021030.tar.gz (Built on: Apr 02, 2008 10:30 UTC)

Reproduce code:
---------------
<?php
// Set ini file location
$iniFileLocation = dirname(__FILE__) . '/test.ini';

// Build ini data
$iniData = '[database]
db_user = username
db_pass = "$@Yb^0P%$4$*"
db_name = database
db_host = localhost';

// Save ini data to file
file_put_contents($iniFileLocation, $iniData);

print_r(parse_ini_file($iniFileLocation));

Expected result:
----------------
Array
(
    [db_user] => username
    [db_pass] => $@Yb^0P%$4$*
    [db_name] => database
    [db_host] => localhost
)

Actual result:
--------------
Warning: syntax error, unexpected $end, expecting TC_DOLLAR_CURLY or
TC_QUOTED_STRING or '"' in /data/www/test.ini on line 3 in
/data/www/test.php on line 15
Array
(
    [db_user] => username
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44609&edit=1



Thread (6 messages)

« previous php.bugs (#124034) next »