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

 ID:                 64077
 User updated by:    iceman2g2 at gmail dot com
 Reported by:        iceman2g2 at gmail dot com
 Summary:            Use of self keyword causing error
-Status:             Feedback
+Status:             Closed
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

This issue has been tracked down. It seems the issue revolved around calling a 
method that 
wasn't declared as static in a static manner.

So a method defined as: 
public function getById($flight)

Was changed to:
public static function getById($flight)


Previous Comments:
------------------------------------------------------------------------
[2013-01-26 11:57:25] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------
[2013-01-25 20:53:11] iceman2g2 at gmail dot com

Description:
------------
PHP Version: 5.3.17
Server API: CGI/FastCGI

I'm using the self keyword to call a method that's defined in an abstract 
class. 
The call to the method itself is being made within the abstract class. The 
method is both private and static.

Here's a definition of the method:
private static function _executeCallback($sequence, $event, array $param = 
array(), Dhonki_Model 
$object = NULL)

This is the snippet of code that calls the method:
if (isset(self::$_event_callback[$model]['find']['after']) || 
isset(self::$_event_callback[__CLASS__]['find']['after'])) {
                        self::_executeCallback('after', 'find', $param, 
$object);
                }

The problem comes with the use of:
self::_executeCallback('after', 'find', $param, $object);

To fix the error I use the code:
Dhonki_Model::_executeCallback('after', 'find', $param, $object);



I don't know if this is an error related to something I'm doing or if it's a 
bug. Again this same code works on several other servers, and in fact works 
several other places in the class.

Clayton

Expected result:
----------------
I expected self::_executeCallback and Dhonki_Model::_executeCallback to be 
functionally equivalent. In fact they seem to be functionally equivalent on 
several other servers using this code. The also seem to be equivalent elsewhere 
in 
the same abstract class that use the self::_executeCallback.

Actual result:
--------------
Unable to autoload `t6exla` class or interface.

I'm not sure where the t6exla is coming from as the name of my class is 
Dhonki_Model.


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



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64077&edit=1

Reply via email to