fix: prevent PHP errors in direct AJAX endpoints#797
Conversation
|
I tested a similar fix in a production-like environment (Debian 12, PHP 8.4.21). |
RussH
left a comment
There was a problem hiding this comment.
Can you check that ajax/bootstrap.php is included first in each direct AJAX endpoint before any legacy library includes, doesn't seem to be first in every instance.
|
Thanks, I checked the changed direct AJAX endpoints again. In this branch, While checking this, I also noticed that |
This PR adds a shared AJAX bootstrap file and uses it from AJAX endpoints that may be accessed directly. Previously, some direct AJAX requests could fail because required constants or classes were not loaded before endpoint-specific code executed.
The change defines the legacy root path consistently for AJAX requests, loads the required core files, and updates affected includes to use root-based paths where needed. This avoids errors such as missing
LEGACY_ROOT, missing AJAX interface classes and failed relative includes when endpoints are executed from a different working directory.Validation was performed by linting the changed PHP files and directly executing the previously problematic template AJAX endpoints. The endpoints now return the expected not-logged-in XML response instead of producing include or bootstrap-related PHP warnings.