PEAR is archived and read-only

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

Home » Configuration » Config » Bug #6740

Undefined offset: 1 in /usr/share/php/Config/Container.php on line 327

Details

Submitted2006-02-10 06:22 UTC
Fromjustin at koivi dot com
Assignedaashley
StatusBogus
PackageConfig
PHP Version5.0.5
Roadmaps(Not assigned)

Comments

[2006-02-10 06:22 UTC] justin at koivi dot com

Description:
------------
searchPath method assumes that an array arg will always have 2 elements passed.

Test script:
---------------
<?php
require_once 'Config.php';
$Config = new Config();
$ConfigRoot = $Config->parseConfig($file,$format);
$ConfigRoot->searchPath(array('config', array('datasource')));
?>

You will get a php notice like:

Undefined offset: 1 in /usr/share/php/Config/Container.php on line 327

To fix, lines 327-331 of Config/Container.php should be:

if (isset($arg[1])) {
$attributes = $arg[1];
} else {
$attributes = null;
}

[2006-02-14 00:14 UTC] aashley at php dot net

By definition the function that array should have two items. It is for searching for a key => value pair. The underlying retrieve code will not work with your suggested fix.

[2006-02-16 22:50 UTC] justin at koivi dot com

I see where I messed up the call...

If the correct input was not provided shouldn't there be some kind of default action to fall back on if it doesn't return an error? (Just an observation.)