Debugging PHP code of a AJAX project using Eclipse PDT and Zend Debugger - ajax

I'm not sure if I'm right or not but it seems that Eclipse PDT + Zend Debugger have problems when it comes to debugging Ajax projects. I'm working on a project in which all of the requests are passed through a single PHP file (even resource requests like downloading images). And when I want to start a debug session in Eclipse after the first request returns successfully, second forth requests return the following error message:
A communication error occurred with the Zend Studio debugger due
to an unfinished debug session. Uncaught SyntaxError: Unexpected token
<
To reload the page click Refresh
It seems to me that since the first request is keeping the Zend Server busy, the second forth requests can not make a successful connection to it. It's in the case that I've configured the Eclipse so it won't stop at the first line of every page but still no luck.
Does this mean that in PHP + Ajax projects which requests are sent freely, it is impossible to debug? Has anyone tested this and/or the xdebug in a similar scenario?
Regards,

I just wanted to let my fellow developers to know that the same problem DOES NOT exist when I switched to xdebug.

Related

GoLang SPA returning 500 Internal Server Error on Refresh only

I have a golang API app that is currently serving double-duty as a Single Page App server with static content using the method shown here: https://hackandsla.sh/posts/2021-11-06-serve-spa-from-go/
Everything is working great in terms of navigation until users try to refresh URIs with encoded JSON in them. For example:
/licenses
will refresh file and draw the page as it would normally have appeared through internal history.push()
/licenses/show/%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
will cause the 500 error.
I did the initial development with IIS as a web server so these Refresh errors never happened in that environment. And when the server is ready to be deployed I plan to use Caddy and reverse proxy the API and am assuming it will handle the Refreshes with the same aplomb as IIS.
But for now I am hoping to run tests against my simple server so I'd like to solve this issue out of curiosity in addition to development expediency.
Bottom line: What cause golang http.ListenAndServe to return 500 errors?
UPDATE:
As I need to be able to test and hand off for others I have converted to a querystring which http.ListenAndServe is happy with:
/licenses/show/%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
causes 500 error
/licenses/show?state=%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
works fine

Firefox seems to fail on registering a ServiceWorker for Push Notifications?

Firefox seems to fail on registering a ServiceWorker for Push Notifications, with an error "InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable", but the code works in Chrome and Edge, and appears to be compliant with the examples online and the spec.
I've thrown an example up on one of my test sites, https://wiegandtech.net/ - visiting it in Chrome will prompt for permission and then opt-in successfully, sending the info to the server. But Firefox prompts, doesn't complete the registration, and doesn't fire any error or throw anything into the console. When I try to debug, it seems to never return from navigator.serviceWorker.ready.then call - I debug in and reg is undefined, even though the promise says it shouldn't be. I can find no reason why this is failing. I do see in Fiddler that FF gets the worker file, so it appears to be starting the call, but never finishing? The worker is valid JavaScript, as far as I can tell. Does anyone have any documentation on how Firefox's implementation is different from Chrome's/the spec?
Firefox requires the ServiceWorker's URL to end in .js - I was using an ASP.Net site and returning javascript but through my own controller. When I just give it the URL for the .js file itself, it now works. Would file a bug, but too non-trivial to setup a site given that ServiceWorkers require a real life site to troubleshoot, and their source code doesn't appear to be on github.

Why is my meteor app getting these errors on firefox but not other browsers?

The web app that I am building in meteor works in chrome and I.E.(Other than a UI bug in I.E.) but it starts acting strange in Firefox. When I run it on my localhost and on the deployment to meteor.com, I don't get any errors in the console in the browsers' developer tools.
When I run it in Firefox, things start acting weird. On Mac OSX, if I run the app on my localhost and open it in FF it is just fine. However, when I open up the app that deployed to meteor.com via meteor deploy [my-app-url].com, I get the following errors but I can still use everything in my app:
Error 1:
mutating the [[Prototype]] of an object will cause your code to run very slowly;
instead create the object with the correct initial [[Prototype]] value using Object.create
Error 2:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
at https://ddp--3071-[my-app-url].com/sockjs/info?cb=v9pygo9mzn.
(Reason: CORS request failed).
While right now I am not able to figure out what is causing the first error, I am mostly worried about the second error.
When I open up the app from it's deployment in FF on Windows 8, I get the first error once, and then I get the second error repeatedly and the app never loads(it just stays on my loading template from the iron router). My deployed app runs just fine on Chrome and I.E.
I don't send any kind of request to another server in my app, so I am not sure why I am getting a CORS request error. I have not set up SSL or began to make a certificate yet, so I am not sure if this could be causing this kind of error in FF as I got another exception on my login page in FF on my localhost saying that I shouldn't have password elements when I'm not using https.
Does anyone know what could be causing this?
Sorry that I provide any code, as I don't know what code I would post to solve this problem since I don't actually request anything from another server in code that I have written.
Thanks in advance for any responses!
If anyone is interested, it seems as if my combination of the aldeed:collectio2 package and one of my other packages was the cause of my problems. I removed this package and my issues went away.

Ajax not working with SSL on IE error code 12019

I am working on a web application built on Java, JSP, Ajax the servers are JBoss with front in Apche 2 server. The application is accessed over the internet. clients are using mostly IE 7, 8, 9 Browsers.
The application was working perfectly before.Recently we applied SSL certificates over the site, after this we started getting complaints from the user that pages where Ajax is applied are not submitting. Normally we call the ajax on submit button and block the page till response is received from the server. we applied loggers and found that the ajax request calls are failed with ajax jqXHR error status as 12019.
We observed that this error is observed by the users where IE (mostly version 8 and 9) is used. the pattern of error is also not same. some time the same user able to submit page who complaint earlier and some time not. i tried best to produce this scenario over my local and development environment but could not.
i google the problem and found something that 12019 error code is a bug of IE. but why it worked before applying the SSL,
and if SSL is not correct why the problem is only at the ajax page why not somewhere else. I cant say users to change the browser.
This driving me crazy for more then a week. Please help me if anyone else has observed and solve this before.
This is due to IE attempting to cache something it shouldnt.
There are 2 options
Add no cache headers
"If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT"
"Cache-Control", "no-cache"
Append a cache busting parameter
"x-1&y=2...&ieispoo="+Date.now()
I realize this is an old question, but someone else might benefit from the answer.

Handling empty HTTP response with Glimpse

I'm integrating Glimpse to a legacy production application (Upgraded to MVC3). Most pages have a lot of ajax requests and some of the ajax requests return an empty response based on the business logic.
Glimpse client fails to parse such empty responses (out of may be 20-30 responses). Chrome console clearly shows where it fails.
Uncaught TypeError: Cannot call method 'indexOf' of null Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.processContentType Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.update Glimpse.axd?n=glimpse_client&hash=0a37c827:3657
display.ajax.XMLHttpRequest.open
The reason is that the processContentType function is given a 'null' as contentType (variable named 'type' within the function) and the following statement fails.
return type.substring(0, type.indexOf(';'));
What bothers me is the fact that the whole Glimpse window does not show up (Glimpse icon is not hyper-linked to open up the Glimpse tabs) as a result. Is there anyway (configuration?) to workaround the issue?
Thank you!
The issue was resolved by updating Glimpse to 1.5.0.
---Here's the comment from Glimpse;
avanderhoorn commented 6 hours ago
You must be running an old version of Glimpse.core. This was fixed with PR #401 (reported in
#400) and went live in release https://github.com/Glimpse/Glimpse/releases/1.5.0.
All I did was 'Update-Package Glimpse' in VS package manager console and it's fixed now.

Resources