开发者

PHP: Non static method called as it was static, how is that possible?

开发者 https://www.devze.com 2023-03-07 01:48 出处:网络
is there anyway to call a non static method, as an static method? I have found this call: $handler =& ProfileHandler_Array::getInstance(

is there anyway to call a non static method, as an static method?

I have found this call:

$handler =& ProfileHandler_Array::getInstance(
    array(  'username'        => $this->api_username,
            'certificateFile' => $this->api_certificate,
            'signature'       => $this->api_signature,
            'subject'         => $this->api_subject,
            'environment'     => (($t开发者_高级运维his->api_test)?'Sandbox':'Live')
    )

And here you have getInstance() method:

function getInstance($id, &$handler)
{
    $classname = __CLASS__;
    $inst = new $classname($id, $handler);

    $result = $inst->_load();
    if (PayPal::isError($result)) {
        return $result;
    }

    $result = $inst->loadEnvironments();
    if (PayPal::isError($result)) {
        return $result;
    }

    return $inst;
}

and it doesn't give any errors!!!!

More clues: it's maybe an old code.

Regards


Your code should give an error, it just isn't displayed. (Is error_reporting set to E_ALL | E_STRICT? Is display_errors enabled?)

From the manual:

Calling non-static methods statically generates an E_STRICT level warning.

0

精彩评论

暂无评论...
验证码 换一张
取 消