[PEAR-BUG] Bug #17585 [NEW]: Pyrus - Channel registry exists bug

[email protected] ("warnar at dmmw dot nl") Tue, 13 Jul 2010 12:36:44 +0000 (GMT)
Newsgroups php.pear.doc
Message-ID <[email protected]>
From:             boekkooi
Operating system: Windows 7 x64
Package version:  
PHP version:      5.3.1
Package:          Documentation
Bug Type:         Bug
Bug description:  Pyrus - Channel registry exists bug

Description:
------------
Create a new \PEAR2\Pyrus\Config with a directory that is not yet a
registry. 
Get the channelregistry and check if 'pear2.php.net' exists.

This will return 1.

After this try to get the channel and a exception will be thrown.

Test script:
---------------
$config = PEAR2\Pyrus\Config::singleton('D:\pear\testRepo');

// Expected result false or a exception saying that the channel registry is
not initialized or initialize the registry.
// Current result 1
$res = $config->channelregistry->exists('pear2.php.net'); 
if ($res) {
	echo 'Channel exists ' . PHP_EOL;
} else {
	echo 'Unknow channel' . PHP_EOL;
}

// Throws 'PEAR2\Pyrus\ChannelFile\Exception: Invalid channel.xml'
// This is unexpected behavior
$config->channelregistry->get('pear2.php.net');

Expected result:
----------------
- Make channelregistry->exists return false
or
- Let it throw a exception
or
- Let it initialize the repository

Actual result:
--------------
See test script

-- 
Edit bug report at http://pear.php.net/bugs/bug.php?id=17585&edit=1
--