ZF1 Get errors before redirect

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ZF1 Get errors before redirect

AlexRose

As the title says, I want to get all errors before the redirect. So this is my case:

I have a select for changing databases(identical structure but different data); So let's say I am here: localhost/user/edit/id/100 (database 1) on db change, I am redirecting the user to the same page, but we load data from database 2. If it is not found, I get an error:

"Fatal error: Call to a member function on a non-object ..."

How do I catch the errors before the redirect occurs in order to change the url? Thanks!
Reply | Threaded
Open this post in threaded view
|

RE: ZF1 Get errors before redirect

demiankatz
One problem you're facing here is the fact that when PHP throws a fatal error, PHP code stops executing. You can't write PHP code to react to a fatal -- it's too severe. So the first thing I'd recommend doing is figuring out what is causing the "member function on non-object" error, writing some checks to avoid it, and doing something more PHP-friendly (like throwing an exception) if there is a problem.

- Demian
________________________________________
From: AlexRose [[hidden email]]
Sent: Friday, January 17, 2014 5:32 AM
To: [hidden email]
Subject: [fw-general] ZF1 Get errors before redirect

As the title says, I want to get all errors before the redirect. So this is
my case:

I have a select for changing databases(identical structure but different
data); So let's say I am here: localhost/user/edit/id/100 (database 1) on db
change, I am redirecting the user to the same page, but we load data from
database 2. If it is not found, I get an error:

"Fatal error: Call to a member function on a non-object ..."

How do I catch the errors before the redirect occurs in order to change the
url? Thanks!




--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF1-Get-errors-before-redirect-tp4661481.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]