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

Call to a member function prepare() on a non-object in vendor\redbean\rb.php on line 92 #138

Closed
katanacrimson opened this issue Mar 15, 2012 · 6 comments

Comments

@katanacrimson
Copy link
Contributor

For some reason, $this->pdo is getting nuked in RedBean at some point.

Screenshot

In fact, queries prior to this one run just fine - this one, however, is being run on an object's __destruct call if that makes any difference.

edit: As you can also see here, the prior queries (I enabled R::debug for this) run just fine.
http://puu.sh/kQ8Y

and the var_dump there is of what is being stored (using the following method in my own code)

<?php
    public function __destruct()
    {
        var_dump($this->session);
        R::store($this->session); // and this is where it all blows up
    }

Not sure what to think of this. Is RedBean not safe to rely on within the register_shutdown_function() context?

@katanacrimson
Copy link
Contributor Author

Nevermind, found the issue - stray R::close() call.

Can we get an exception to be thrown within RedBean if $this->pdo isn't present (to make it a bit easier to debug)?

@gabordemooij
Copy link
Owner

I really need to add some convient exceptions that is true.

@gabordemooij
Copy link
Owner

done

@SalocinDotTEN
Copy link

Having the exact same issue but I am intending to load and process the databases from a list, one by one in a for loop. :-)

Is there any way to go around this error to be able to close then setup the next file?

@katanacrimson
Copy link
Contributor Author

If an exception was added for "no PDO object being present internally" (or something like that) a try/catch would work.

e: wait...why not use named database connections for your circumstance?

@katanacrimson
Copy link
Contributor Author

@gabordemooij I just noticed an underlying problem here that this is a symptom of - shouldn't RedBean_Driver_PDO::close() set its property isConnected to bool(false) when called?

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

3 participants