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

ID: 18677
Updated by: kvz@php.net
Reported By: adam at happy dot cat
Summary: System_Daemon_OS::factory() called statically
-Status: Assigned
+Status: Closed
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
Roadmap Versions:
New Comment:

-Status: Assigned
+Status: Closed
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

https://github.com/kvz/system_daemon/commit/4e76299e0bb838ea038f31803f6f8b9
d95f4c810

Thanks for reporting!


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

[2011-08-31 14:27:07] drpheltright

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

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

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

-Assigned To:
+Assigned To: kvz
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
postedJan 24, '12 at 1:43p
activeJan 24, '12 at 1:43p
posts1
users1
websitepear.php.net

1 user in discussion

Kvz: 1 post

People

Translate

site design / logo © 2022 Grokbase