Xdebug not stopping at breakpoints when using Ajax

Viewed 271

Let me just start with what I am using:

  • PHP 7.3.25
  • VSCode 1.52.1
  • Xdebug See description

So let me explain the issue... I've been debugging with Xdebug for a while now. It has always served me well, unless it was about ajax calls. Sometimes when I call a PHP script with Ajax my Xdebug just stops working... I keep seeing 2 requests running in the call stack tab:

enter image description here

I've tried updating my Xdebugging running 100 different settings but nothing will work...

Right now my php.ini is this:

enter image description here

And my launch.json is this:

enter image description here

This is my ajax call:

var formData = new FormData();
  formData.append("projectId", id);
  formData.append("ajaxAction", "getProjectData");
  sendAjax(formData, (data) => {
    const json = JSON.parse(data);
    updateProject(json);
  });
function sendAjax(formData, cb) {
  $.ajax({
    type: "POST",
    data: formData,
    cache: false,
    processData: false,
    contentType: false,
    url: $("#url").val() + "Ajax",
    success: cb,
    error: function (jqXHR, exception) {
      alert("ajaxerror: " + jqXHR.responseText);
    },
  });
}

If anyone knows the solution ur an absolute god. I've visited over 100 sites and put a total of 3 days into this trying to fix it.

UPDATE This is the day after I posted this. I found it the bug is because of something in the code itself... When I switched to another branch in GitHub my Xdebug worked fine but when I switched back to the master branch everything stopped working... I checked everything and compared it to my old code, I cannot find the issue.

My quest now is actually, where do I look?

0 Answers
Related