Bug #81620 [NEW]: parse_ini_file and parse_ini_string don't actually support value interpolation

From: Date: Sat, 13 Nov 2021 14:33:15 +0000
Subject: Bug #81620 [NEW]: parse_ini_file and parse_ini_string don't actually support value interpolation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237745@lists.php.net to get a copy of this message
From:             php dot net at keven dot fr
Operating system: Linux
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Bug
Bug description:parse_ini_file and parse_ini_string don't actually support value interpolation

Description:
------------
From the documentation, parse_ini_file() and parse_ini_string() should
support value interpolation:

var_dump(parse_ini_string('
foo = bar
baz = ${foo}
'));

should produce:

array(2) {
  ["foo"]=>
  string(3) "bar"
  ["baz"]=>
  string(3) "bar"
}

but it produces this instead:

array(2) {
  ["foo"]=>
  string(3) "bar"
  ["baz"]=>
  string(0) ""
}

See it live: https://3v4l.org/K15ft

On the other hand, env var value interpolation seems to work:

var_dump(parse_ini_string('
path = ${PATH}
'));

result:

array(1) {
  ["path"]=>
  string(13) "/usr/bin:/bin"
}

See it live: https://3v4l.org/cE4dL



Test script:
---------------
var_dump(parse_ini_string('
foo = bar
baz = ${foo}
'));


Expected result:
----------------
array(2) {
  ["foo"]=>
  string(3) "bar"
  ["baz"]=>
  string(3) "bar"
}


Actual result:
--------------
array(2) {
  ["foo"]=>
  string(3) "bar"
  ["baz"]=>
  string(0) ""
}


-- 
Edit bug report at https://bugs.php.net/bug.php?id=81620&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81620&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81620&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81620&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81620&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81620&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81620&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81620&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81620&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81620&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81620&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81620&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81620&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81620&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81620&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81620&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81620&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81620&r=mysqlcfg


Thread (1 message)

  • php dot net at keven dot fr
« previous php.bugs (#237745) next »