Zend Error controller stopped working for 500 - zend-framework

My Zend application was running fine until today, when I changed something which caused the error controller to stop working.
I have debugged every part of the code but I can not find any traces as to why is it happening
If I produce a 404 error, the error controller runs perfectly. But in case of 500, the control does not go to error controller.
I have tried many things but am still unable to find out what's wrong. I have searched the internet but people who encountered this problem, seemed to get no answer :(
Any help would be much appreciable
I have debugged the application step by step and found out that in case of 500, the execution stops instantly when it encounters a fatal error or exception
(UPDATE)
If I do something like...
$blabla->getInfo();
where $blabla is not defined, I don't get redirected to error controller.
But if I do something like...
Zend_Registry::get('blabla');
where no key is set for 'blabla' in Zend_Registry, then I get redirected

500 is a general server error, so no wonder the control does not go to your controller.
You will need to check your server logs to find out what is causing the error.
Also, try to recall whether you have altered your .htaccess file(s) recently and/or created an infinite redirect loop by accident.

Related

Magento2 product detail page's title showing 404 Not Found Error

Everything works fine but product detail page's title showing 404 Not Found Error.
Any one faced same error before?
I have faced this issue and it wasn't a rewrite problem.
Try attaching the debugger to the try/catch in \Magento\Catalog\Controller\Product\View::execute since this one does a redirect to noroute in the catch.
In my case, way I found out we made an override for vendor/magento/module-catalog/Helper/Product/View.php where $pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));
throws an Exception because $string was declared private in the original and should use \Magento\Framework\Stdlib\StringUtils instead.
Anyway, searching for things like $resultForward->forward('noroute'); and attaching debugger there is a good way to start.
This is happening due to any exceptions are throwing while loading the PDP pages. Mostly the error is throwing from vendor/magento/module-catalog/Helper/Product/View.php

How to test an error page with Error 500 using Zend Framework

I am working on a project where client requires me to beautifully display error 500 with stacktrace etc.
So, I checked the Error Controller and made a nice fancy error page in corresponding views/script
The problem is, how do I test it?
Whilst working on the project, I cleared error on every page and there is no way I could generate it again. Also, I am using doctrine and I remember "echo-ing" the entitymanager array but, I cannot trace the location.
How would I custom generate error 500, "keeping it real"?
PS: I tried htaccess thing and trust me, it throws apache error and not zend 500.
It was pretty silly but, finally found it.
All I needed was to mis-spell a dql tablename on any page where I use querybuilder.

Troubleshooting 500 Server Error Zend Framework application

I am facing a 500 Server Error and I see that many people here have had this problem and it can be too broad so I would like to ask my question differently.
I have confirmed with my host that the server is fine and if I replace content of index.php in public_html it shows everything is working. The problem seems to be in my script/environment and I am trying to track it down. My question is which are the common paths to check?
I have confirmed that its going through application.ini fine, the front controller plugin is fine (I have 1), the routing is working fine but it doesnt get as far as the IndexController which I am testing with.
I have tried to wrap $application->bootstrap()->run(); in a try-catch but this didnt help. Any help with how to troubleshoot such an issue appreciated. I am trying to track through what the application is doing to find where it fails.
I solved this problem. Turns out I had an infinite loop in my application in one model. I traced through the dispatch process until I narrowed down to the line that was causing trouble and removed it. Was helpful to me in walking through what the application does step by step and ticking off everything.

Prevent error messages logged by system framework

The following message keeps getting logged to the console:
-[__NSCFSet minusSet:]: This app appears to be calling this method with
a non-set parameter. Please wait while the system corrects this...
I don't know what I did to this appear. I never call this function and don't know what things call this.
For me, this appear when a touch anything in my UIWebView. This can be a touch in text box, or just a simple touch in any area of the page. Any new touch will produce it.
Anyone have an idea how to solve it?
You should be able to find out whether your code is causing the log message or not. You can do this by interrupting the app when the message is logged and looking at the stack backtrace of the logging thread. Then, investigate what code created the object that is prompting the log message using malloc history or Instruments.
To start with, you can try adding a symbolic breakpoint on -[__NSCFSet minusSet:]. You could narrow it down to the actual code doing the logging if you looked at the disassembly for a call to NSLog and placed the breakpoint there.
Once you've ruled out your code, it's not your fault: it's time to file a bug report and move on. If the log messages are swamping more interesting log messages, you might try patching the binary so it doesn't log, but just living with it is likely to be easier (though much less fun).

asp.net mvc 2 global.asax.cs being ignored

I was having trouble debugging why a route was throwing a 404 when I was positive I set it up correctly. I made changes, rebuilt, still 404, I did all kinds of crazy stuff to the route but always 404.
then in my frustration I just deleted ALL the routing in global.asax, saved rebuilt and ran. I still got 404...
but the rest of the site didn't break!! how can this be? I thought you had to route paths or nothing would work... even my custom routing still worked. I rebuilt, resaved web.config. I even stopped the website, and even the application pool and even IIS ENIIRELY, then restarted evertyhing...
all my routing still seems to be there!
I even threw a divide by zero and even FORCED an exception to be thrown on Application_Start... none of it changed anything...
what in the holy hell is going on? are my routes being cached somewhere? WHERE?!
Try this post as a start point.
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
I had a similar issue that in my head I thought I was accounting for, but it turned out not to be the case. With this, you would see which routes are being loaded, which are being ignored, and ultimately, which route you are matching.
okay this was retarted. it turns out that SOMEHOW, the following line was removed from my csproj file:
<Content Include="Web.config" />
I don't know how it happened or why.. it's dumb and retarted and I'm completely upset that I lost two days of productivity because of it...
but I'm glad it's fixed. thanks for your help!