Bug #72578 [NEW]: parse_ini_string() doesn't store extension/zend_extension entries correctly
| From: | kurt dot newman at cpanel dot net | Date: | Mon, 11 Jul 2016 19:12:50 +0000 |
| Subject: | Bug #72578 [NEW]: parse_ini_string() doesn't store extension/zend_extension entries correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202209@lists.php.net to get a copy of this message | ||
From: kurt dot newman at cpanel dot net
Operating system: Linux
PHP version: 7.0.8
Package: Unknown/Other Function
Bug Type: Bug
Bug description:parse_ini_string() doesn't store extension/zend_extension entries correctly
Description:
------------
---
From manual page: http://www.php.net/function.parse-ini-string
---
This impacts PHP versions: 5.4.45, 5.5.37, 5.6.23, and 7.0.8.
The documentation does not say that ini entries will be missing and
should be considered a bug. The documentation says:
parse_ini_string() returns the settings in string ini in an
associative array.
As such, this function doesn't properly parse a PHP ini string AND
return the complete settings described in said string within a resulting
associative array.
Test script:
---------------
<?php
# How to duplicate
# echo -e "extension = foo.so\nextension = bar.so\n" > foo.ini
# cat foo.ini | ./thisscript.php
$ini = "";
$stdin = fopen('php://stdin', 'r');
while (($line = fgets($stdin)) != false)
$ini .= $line;
fclose($stdin);
if (!($arr = parse_ini_string($ini, true, INI_SCANNER_RAW))) {
fwrite(STDERR, "ERROR: Invalid php ini format\n");
exit(1);
}
print_r( $arr );
exit(0);
?>
Expected result:
----------------
Recognize that the 'extension' and 'zend_extension' ini entries are
special, and can be duplicated within an ini file. Perhaps consider
placing them in some special place so that this information isn't lost.
This is just an example, and not a request to use this specific output:
Array
(
[extension] => Array
(
[extension0] => foo.so
[extension1] => bar.so
)
)
Actual result:
--------------
# Observe that "foo.so" was defined in the example noted in
# the 'Test script', but is missing in the actual usage.
Array
(
[extension] => bar.so
)
--
Edit bug report at https://bugs.php.net/bug.php?id=72578&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72578&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72578&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72578&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72578&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72578&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72578&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72578&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72578&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72578&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72578&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72578&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72578&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72578&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72578&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72578&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72578&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72578&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72578&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72578&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72578&r=mysqlcfg