Problem/Motivation
When the display_errors feature is enabled in php.ini and an AJAX request exceeds the post_max_size limit the AJAX command will not be executed. At the top of the AJAX response a PHP warning will be present: "POST Content-Length of x bytes exceeds the limit of y bytes". This invalidates the JSON and the AJAX command will not be executed.
A simple way to replicate this is by enabling display_errors and uploading a file that exceeds the post_max_size through the standard file field widget. The AJAX response that should normally show an error message is not executed and nothing seems to happen to the end user.
Proposed resolution
Maybe disable display_errors at runtime for AJAX responses, instead delegating the errors to the watchdog, or perhaps clearing the PHP output buffer before rendering the AJAX response so that the error is not present in the JSON body.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #13
smustgrave commentedThank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.
Since there has been no activity here for over 8 years we are asking if this problem persists on a currently supported version of Drupal. To help, add a comment explaining if the problem still occurs or not. Any extra detail you can provide can help others who experienced this.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #15
hitchshockI reproduced the same bug.
Steps:
- Drupal 11.2
- Add a file field to the content
- Try to upload the file with a size larger than the PHP upload limit
- An AJAX error occurred because of an incorrect AJAX response
But it seems like the solution in #3494148: AJAX Response Not Sanitized For Length fixes the issue.
Can someone try to reproduce the issue and try to fix it by solution from 3494148.
This may assist others in resolving a similar issue.
Comment #16
smustgrave commentedMay still be the correct status.
If this gets closed please move over credit for @hitchshock to #3494148: AJAX Response Not Sanitized For Length