No Code Attached Yet
avatar PhilETaylor
PhilETaylor
28 May 2021

Steps to reproduce the issue

Issue Forked from #34233 (comment)

It is possible to generate an uncaught exception in Mail Templates when path::check detects snooping

This issue is two parted

  1. The Joomla global configuration test mail button - when pressed, an exception occurs that is unhandled gives the wrong error, when it should tell you the exception message

Screenshot 2021-05-28 at 17 11 46

  1. More generically - any Mail sending with Mail Templates could throw an exception, and that is unhandled within the mail sending, so the code could fatal error on any mail being sent when an exception is thrown (mainly from Path::check- I dont have steps to replicate this but I think my logic is right.

Expected result

Exception is handled and returned

Actual result

  1. An error has occurred while fetching the JSON data: HTTP 502 status code. Bad Gateway" error message shown on the page

  2. PHP Fatal error.

System information (as much as possible)

Additional comments

avatar PhilETaylor PhilETaylor - open - 28 May 2021
avatar joomla-cms-bot joomla-cms-bot - change - 28 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 May 2021
avatar Fedik
Fedik - comment - 28 May 2021

As far as I remember such JSON error happen for broken response, in your case 502 Bad gateway, server just crashes.
It not Exception.

avatar Fedik
Fedik - comment - 28 May 2021

like this:
image

avatar PhilETaylor
PhilETaylor - comment - 28 May 2021

yup - well thats bad too haha... The exception is being thrown as I debugged that far, but you are right I did not debug all the way to the response.

This should be fixed though, its a valid bug

avatar Fedik
Fedik - comment - 28 May 2021

Need a way to replicate it ;)

We have global exception handler, that in theory should catch everything. Maybe server just decided to die ?

avatar PhilETaylor
PhilETaylor - comment - 28 May 2021

Ive not had much time this week sorry, i should have more time over the weekend and next week to catch up with this.

avatar Fedik
Fedik - comment - 28 May 2021

Take your time, nothing really critical here ;)

avatar dgrammatiko
dgrammatiko - comment - 28 May 2021

What's the endpoint for the Ajax request?

Obviously there should be a try/catch when trying to parse a JSON response and pretty sure that there are many instances that missing it

avatar Fedik
Fedik - comment - 29 May 2021

Obviously there should be a try/catch

There is try/catch, and then "catch" shows error which @PhilETaylor posted.
It not JS, it server side error.

avatar PhilETaylor
PhilETaylor - comment - 1 Jun 2021

The root issue is that throwing an exception, with code 20 from php-fpm back to the web server is invalid... and so nginx shows a Bad Gateway (gateway = php-fpm)

webserver_1  | 2021/06/01 15:10:43 [error] 31#31: *109 upstream sent invalid status "20" while reading response header from upstream, client: 172.19.0.1, server: , request: "GET /administrator/index.php?option=com_config&task=application.sendtestmail&format=json&af9486544568df6501f01ab2402786ea=1 HTTP/1.1", upstream: "fastcgi://172.19.0.6:9000", host: "127.0.0.1:4444"

PR'ing now.

avatar PhilETaylor PhilETaylor - change - 21 Aug 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-08-21 13:22:30
Closed_By PhilETaylor
Labels Added: No Code Attached Yet
Removed: ?
avatar PhilETaylor PhilETaylor - close - 21 Aug 2021

Add a Comment

Login with GitHub to post a comment