okey_on
okey_on

Reputation: 3006

Possible reasons why a valid PHP class method would not work

I have this perfectly valid and defined PHP class method that just refuses to work. I have this class:

class SessionHandler{
    public function startSession(){
        ....
        ....
    }

    public function endSession(){
        ....
        ....
    }
}

So I instantiate object and call method:

$sessHandler=new SessionHandler();
$sessHandler->startSession();

It used to work, but somehow just stopped working, with this error:

Fatal error: Call to undefined method SessionHandler::startSession() in C:\wamp\www\mywebapp\models\user.php on line 212

I have gone over the code and cannot find anything wrong. The class and method I called are very much valid and fully defined. So I'm just wondering if there's some kind of bug in PHP that causes this behaviour. I use PHP version 5.4.16

Upvotes: 0

Views: 274

Answers (1)

chrisguitarguy
chrisguitarguy

Reputation: 2369

PHP 5.4+ has it's own, built-in class named SessionHandler. Since the class already exists, whatever autoloading strategy you're using is not loading your version of SessionHandler.

Upvotes: 4

Related Questions