PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Configuration » Config » Bug #7544

Empty attributes in ini file are being discarded

Details

Submitted2006-05-02 17:12 UTC
Fromluis at m3 dot net
Assignedaashley
StatusClosed
PackageConfig
PHP Version5.0.4
OS2.6.15-1.1830_FC4smp
Roadmaps(Not assigned)

Comments

[2006-05-02 17:12 UTC] luis at m3 dot net

Description:
------------
Parsing an ini file using IniCommented container is losing the empty attributes.

Test script:
---------------
[mySection]
myFirstAtt=123
mySecondAtt=

$oConfig = new Config();
$oConfig->parseConfig($filename, 'IniCommented');

The element mySecondAtt is lost.

PATCH:

--- pear/Config/Container/IniCommented.php (revision 4831)
+++ pear/Config/Container/IniCommented.php (working copy)
@@ -121,8 +121,12 @@
function _quoteAndCommaParser($text)
{
$text = trim($text);
- if ($text == '') {
- return array();
+ if ($text == '')
+ {
+ $emptyNode = array();
+ $emptyNode[0][0] = 'normal';
+ $emptyNode[0][1] = '';
+ return $emptyNode;
}

Expected result:
----------------
It is expected for the parser to aknowledge and store the empty attribute

Actual result:
--------------
The parser discards the empty attribute

[2006-05-30 06:51 UTC] aashley at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.