[PEAR-BUG] Bug #18673 [Opn->Csd]: Incorrect handling of possibility in get function

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18673&edit=1

 ID:               18673
 Updated by:       [email protected]
 Reported By:      remi dot sauvat at inetprocess dot com
 Summary:          Incorrect handling of possibility in get function
-Status:           Open
+Status:           Closed
 Type:             Bug
 Package:          Config_Lite
 Operating System: GNU/Linux Ubuntu 11.04
 Package Version:  0.1.1
 PHP Version:      Irrelevant
-Assigned To:      
+Assigned To:      pce
 Roadmap Versions: 
 New Comment:

-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: pce
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/

thanks for the bugreport and for the submitted a pach :) 
i added a testcase and adjusted your patch.


Previous Comments:
------------------------------------------------------------------------

[2011-07-18 16:37:34] rsauvat_inet

Added #patch bug:18673;patch:fix-get-function;revision:1311003454;.

------------------------------------------------------------------------

[2011-07-18 16:33:30] rsauvat_inet

Description:
------------
When calling the get function from the Config_Lite class 
with a section not found php display notices and 
warning. In attached file a patch is available.

Test script:
---------------
$config = new Config_Lite();
$config->read("config.ini");
$pid = $config->get("sys", "pid_file", "/var/run/mypid");


//Config.ini
[test]
foo = bar

Expected result:
----------------
If section 'sys' is not found the function should return the 
default value if !== null without php errors.

Actual result:
--------------
Undefined index: sys
PHP Notice:  Undefined index: sys in 
vendor/Config/Lite.php on line 342
array_key_exists() expects parameter 2 to be array, null 
given
PHP Warning:  array_key_exists() expects parameter 2 to 
be array, null given in vendor/Config/Lite.php on line 342

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18673&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.