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

ID: 18677
Comment by: drpheltright
Reported By: lukemorton dot designs at gmail dot com
Summary: System_Daemon_OS::factory() called statically
Status: Assigned
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: kvz
New Comment:

This is a part of a wider problem in that PHP Strict standards are not
being applied across this code base.

Other errors include:
- Non-static method System_Daemon_OS::_mostSpecific() should not be
called statically in
/home/httpd/luke.morton/devious-server/develop/modules/kvz/systemdaemon/System/Daemon/OS.php
on line 144
- array_map() expects parameter 1 to be a valid callback, non-static
method System_Daemon_OS::_getAncestorCount() should not be called
statically in
/home/httpd/luke.morton/devious-server/develop/modules/kvz/systemdaemon/System/Daemon/OS.php
on line 548
- Non-static method System_Daemon_OS::_getAncestors() should not be
called statically in
/home/httpd/luke.morton/devious-server/develop/modules/kvz/systemdaemon/System/Daemon/OS.php
on line 579
- Only variables should be passed by reference in
/home/httpd/luke.morton/devious-server/develop/modules/kvz/systemdaemon/System/Daemon/OS.php
on line 550


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

[2011-07-30 11:41:54] doconnor

<div id="changeset">
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: kvz</span>
</div>Thanks for the report Adam!

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

[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.

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 31, '11 at 12:29p
activeAug 31, '11 at 12:29p
posts1
users1
websitepear.php.net

1 user in discussion

Drpheltright: 1 post

People

Translate

site design / logo © 2022 Grokbase