Closed (cannot reproduce)
Project:
Drupal core
Version:
11.x-dev
Component:
ajax system
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
31 Dec 2014 at 16:14 UTC
Updated:
10 Nov 2025 at 09:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
David_Rothstein commentedHere's a patch, as well as a couple patches that allow manual testing (based on #92944: Display generic message and log detailed message when file upload fails due to PHP error where I discovered this).
Go to admin/config/development/logging and configure error messages to display to the screen, then create a node and upload a file. With the patch the error message is displayed; without it it isn't.
Comment #2
David_Rothstein commentedI didn't test Drupal 7 but the code looks similar there so the bug probably occurs too. This might be backportable although we need to think about whether there are any unexpected side effects.
Comment #3
nod_haven't tested it but one problem I see is that if the JS expected is some JSON object, printing that will trash everything and while everything should be working on the JS side, it won't. Need to look into it.
Comment #4
David_Rothstein commentedWhen messages are set via drupal_set_message() they aren't printed immediately, rather only when some other code intentionally collects and prints them. So in the case of returning a JSON object (or anything that doesn't use Drupal's standard Ajax system) I think the message will just be held until the next page request and displayed then.
However, that is assuming the message is always set via drupal_set_message(). That's the case in Drupal 7, but Drupal 8 actually does it like this (further down in the function):
I am not really sure what this means or what conditions the else statement would be triggered under, but perhaps this patch should have code to make sure the "print $message" can never happen on an Ajax request.
Comment #5
David_Rothstein commentedThe print $message code was added in #2317913: Early error handling can result in fatal error (Call to a member function get() on a non-object) and appears to be there for a legitimate reason. So here's a new patch that makes sure that can never be triggered on an Ajax request (in that rare situation, we can continue eating the message and never displaying it, just like happens now).
Comment #6
jhedstromThis will still only display fatal errors?
Comment #7
dawehnerIt would be quite great to have this issue fixed, given how annoying is that, for example, people often do mistakes as the miss notices.
Comment #8
mgiffordPatch needs re-roll.
Comment #9
vprocessor commentedComment #10
vprocessor commented>>Patch needs re-roll.
Re-rolled, merge conflicts have been fixed
Comment #11
vprocessor commentedComment #13
vprocessor commentedComment #14
vprocessor commentedCode rebuilded, logic saved
Comment #15
vprocessor commentedComment #16
andypostLooks good
Comment #17
catchThere's no confirmation that anyone has manually tested this, instructions are in #1.
Comment #18
andypostLooks to test it properly the patch from #92944: Display generic message and log detailed message when file upload fails due to PHP error
is needed
Comment #19
andypostIs there a steps to reproduce?
Is that enough?
Comment #20
vprocessor commentedComment #21
vprocessor commentedComment #29
sharma.amitt16 commented@vprocessor I believe you forgot to unassign this issue. As there is no activity made by you on this from 4 years. So re-rolling the patch for 9.1.x
as I am getting below error while applying patch #14.
Comment #31
andypostComment #35
smustgrave commentedThis has been tagged for steps and issue summary. So moving to PNMI for that info.
Comment #36
acbramley commentedTrying to manually test this one but it's not clear to me how to generate a warning/info/notice message from a file upload.
Generating an error is easy - just make the file directory non-writeable. Error messages are displayed correctly
Given we've been waiting for proper steps to reproduce this since 2016, I wonder if we just close it for now?
Comment #37
mohit_aghera commentedI came across this issue while doing the bug-smash triage.
It seems we are missing steps to reproduce since almost 10 years.
Closing this issue for now.
Please reopen again if you feel this is reproducible.