NYCPHP Meetup

NYPHP.org

[nycphp-talk] OOP Error/Question

Andy Dirnberger dirn at dirnonline.com
Fri Jul 27 10:15:42 EDT 2007


Try self::Backtrace ();, making sure that Backtrace is marked as static.

 

  _____  

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Ben Sgro (ProjectSkyLine)
Sent: Friday, July 27, 2007 10:11 AM
To: NYPHP Talk
Subject: [nycphp-talk] OOP Error/Question

 

Good morning, 

 

So, I have a script where I'm calling:

 

    function ReceivePOPEmail($popObject)
    {
        $error =
$popObject->Login($popObject->username,$popObject->password,
                                   $popObject->apop);
        if ( $error != '' )
        {
            /* We've had an error. */
            Error::Log("Error: " . HtmlSpecialChars($error),
LOG_LEVEL_ALERT);
            return PROC_FAILURE;
        }
        return PROC_SUCCESS;
    }

 

that's function ... I don't want to pass the Error Object around, so I just
want to call it via:

Error:Log(.....);

 

Now, inside the Error class, there is this code:

            case LOG_LEVEL_ALERT:
                $this->Backtrace( );

 

Which is getting executed. But I'm getting the error:

 

PHP Fatal error:  Using $this when not in object context in
/var/www/html/sk/OOPLIB/ERRO.php on line 101

 

So, how do I call that class's method w/out passing the object around?

 

- Ben

 

Ben Sgro, Chief Engineer
ProjectSkyLine - Defining New Horizons

This e-mail is confidential information intended only for the use of the
individual to whom it is addressed.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070727/81f53f12/attachment.html>


More information about the talk mailing list