Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case sensitivity in Controller.php #336

Closed
umrysh opened this issue Dec 30, 2013 · 1 comment
Closed

Case sensitivity in Controller.php #336

umrysh opened this issue Dec 30, 2013 · 1 comment

Comments

@umrysh
Copy link
Contributor

umrysh commented Dec 30, 2013

Hello,
Thank you for such a great login script!

I ran into a little bit of a snag when installing (It could be that I'm using a shared hosting account on BlueHost). I was getting the following error:

PHP Fatal error:  Call to a member function generateCaptcha() on a non-object

as well a similar error when Facebook login was enabled. It seems to have something to do with case sensitivity in Controller.php

I added in a couple strtolower() calls in the loadModel() function and everything seems to be working now. Just wanted to pass this along in case others encounter the same errors. I can submit the changes as a pull request if you would like, but I'm not sure if there is a more efficient way then my current "hack"

Thanks :)

public function loadModel($name)
{
    $path = MODELS_PATH . strtolower($name) . '_model.php';

    if (file_exists($path)) {
        require MODELS_PATH . strtolower($name) . '_model.php';
        // The "Model" has a capital letter as this is the second part of the model class name,
        // all models have names like "LoginModel"
        $modelName = $name . 'Model';
        // return the new model object while passing the database connection to the model
        return new $modelName($this->db);
    }

} 
@panique
Copy link
Owner

panique commented Dec 30, 2013

Hey @umrysh , thanks a lot, you're totally right! The same thing has happened on the partner project php-mvc: (panique/mini#31). Can you commit this fix into the develop branch please ? I'll instantly release it after a short check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants