PEAR is archived and read-only

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

Home » Logging » Log » Bug #1947

When using Log_composite, children never get the close() method !

Details

Submitted2004-07-22 09:32 UTC
Fromalejandro at todomexico dot com
Assignedjon
StatusClosed
PackageLog
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2004-07-22 09:32 UTC] alejandro at todomexico dot com

Description:
------------
Using Log_composite, when you call the close() method, all the children should call the close() method too, but they not.

// create an instance of Log_composite
$log =& Log::singleton('composite');

// add several childs...
$log->addChild($logF);
$log->addChild($logM);
$log->addChild($logDb);

// log a message...
$log->log($message, $priority);

// when you call the close() method, all children should close, they not.
$log->close();

Reproduce code:
---------------
in composite.php, open() should set $this->_opened to true, so when close() is called, the code is executed.

function open()
{
if (!$this->_opened) {
foreach ($this->_children as $id => $child) {
$this->_children[$id]->open();
}
// should be set to true
$this->_opened = true;
}
}

Expected result:
----------------
All chilldren should execute they respective close() method.

Actual result:
--------------
All chilldren not execute they respective close() method.