Edit report at http://pear.php.net/bugs/bug.php?id=18677&edit=1
ID: 18677
Updated by: [email protected]
Reported By: adam at happy dot cat
Summary: System_Daemon_OS::factory() called statically
Status: Open
Type: Bug
Package: System_Daemon
Operating System: Linux 2.6.35-30-generic-pae
Package Version: 1.0.0RC1
PHP Version: 5.3.1
-Assigned To:
+Assigned To: kvz
Roadmap Versions:
New Comment:
-Assigned To:
+Assigned To: kvz
Thanks for the report Adam!
Previous Comments:
------------------------------------------------------------------------
[2011-07-21 10:55:25] adnam
Description:
------------
The factory method System_Daemon_OS::factory() is defined non-statically
thus:
[System/Daemon/OS.php line 100]
public function &factory($force_os = false, $retried = false)
{
/* .... */
}
It is called in System_Daemon::_osObjSetup() statically, like this:
[System/Daemon.php line 1584]
if (!self::$_osObj) {
self::$_osObj = System_Daemon_OS::factory();
}
System_Daemon_OS::factory() also contains a reference to $this at line
120.
It first needs to be decided if the method should be called statically
or non-statically in order to fix this programming error. If defined
statically, it should not reference $this; whereas if left as-is,
System_Daemon should create a System_Daemon_OS instance and call the
factory something method like this:
if (!self::$_osObj) {
$os = new System_Daemon_OS();
self::$_osObj = $os->factory();
}
However, according to the doc-comments, System_Daemon_OS::__construct()
can "[only be run] by instantiated OS Drivers".
Regards,
Adam Hayward
Test script:
---------------
No test script to report
Expected result:
----------------
No expected result to report.
Actual result:
--------------
No result to report.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18677&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.