#50142 [NEW]: parse_ini_file() constants not used correctly
| From: | jparneodo at yahoo dot fr | Date: | Tue, 10 Nov 2009 19:44:38 +0000 |
| Subject: | #50142 [NEW]: parse_ini_file() constants not used correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-144427@lists.php.net to get a copy of this message | ||
From: jparneodo at yahoo dot fr
Operating system: Ubuntu
PHP version: 5.2.11
PHP Bug Type: Filesystem function related
Bug description: parse_ini_file() constants not used correctly
Description:
------------
Item THREE has bad value.
Input file /tmp/jp.ini:
[CONSTANT]
ONE = "1"
TWO = "2." ONE
THREE = "bug." TWO ONE
Reproduce code:
---------------
<?php
var_dump($ini1=parse_ini_file('/tmp/jp.ini',true));
define('ONE',$ini1['CONSTANT']['ONE']);
echo sprintf("ONE=%s\n",ONE);
var_dump($ini2=parse_ini_file('/tmp/jp.ini',true));
define('TWO',$ini2['CONSTANT']['TWO']);
echo sprintf("ONE=%s TWO=%s\n",ONE,TWO);
var_dump($ini3=parse_ini_file('/tmp/jp.ini',true));
define('THREE',$ini3['CONSTANT']['THREE']);
echo sprintf("ONE=%s TWO=%s THREE=%s\n",ONE,TWO,THREE);
Expected result:
----------------
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(5) "2.ONE"
["THREE"]=>
string(9) "bug.TWO ONE"
}
}
ONE=1
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(3) "2.1"
["THREE"]=>
string(9) "bug.TWO ONE"
}
}
ONE=1 TWO=2.1
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(3) "2.1"
["THREE"]=>
string(9) "bug.2.1"
}
}
ONE=1 TWO=2.1 THREE=bug.2.1
Actual result:
--------------
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(5) "2.ONE"
["THREE"]=>
string(9) "bug.TWO ONE"
}
}
ONE=1
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(3) "2.1"
["THREE"]=>
string(9) "bug.TWO ONE"
}
}
ONE=1 TWO=2.1
array(1) {
["CONSTANT"]=>
array(3) {
["ONE"]=>
string(1) "1"
["TWO"]=>
string(3) "2.1"
["THREE"]=>
string(9) "bug.TWO ONE"
}
}
ONE=1 TWO=2.1 THREE=c.TWO ONE
--
Edit bug report at http://bugs.php.net/?id=50142&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50142&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50142&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50142&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50142&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50142&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50142&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50142&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50142&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50142&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50142&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50142&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50142&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50142&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50142&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50142&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50142&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50142&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50142&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50142&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50142&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50142&r=mysqlcfg