Bug->Doc #81620 [Opn]: parse_ini_file and parse_ini_string don't actually support value interpolation
[email protected] Mon, 15 Nov 2021 12:27:14 +0000
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=81620&edit=1 ID: 81620 Updated by: [email protected] Reported by: php dot net at keven dot fr Summary: parse_ini_file and parse_ini_string don't actually support value interpolation Status: Open -Type: Bug +Type: Documentation Problem -Package: *General Issues +Package: PHP options/info functions Operating System: Linux PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > From the documentation, parse_ini_file() and parse_ini_string() > should support value interpolation: They do, but only if the variable is a proper PHP configuration option which has been explicitly defined in php.ini etc. or an environment variable. Previous Comments: ------------------------------------------------------------------------ [2021-11-13 14:33:15] php dot net at keven dot fr 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 this bug report at https://bugs.php.net/bug.php?id=81620&edit=1