Dependency Graph
View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0019524 | phpList 3 application | General | public | 02-11-18 19:03 | 26-07-19 12:57 |
Reporter | maltfield | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Target Version | 3.3.6 | Fixed in Version | 3.3.6 | ||
Summary | 0019524: return error code on FAIL in ajax subscribe | ||||
Description | This is apparently a long-standing issue with the community-recommended way for users to be able to add subscribers to phplist from an external domain using ajax in phplist3 as described in this thread: * https://discuss.phplist.org/t/ajax-subscribe-api/974 The code in the zip file attached to the above thread uses jquery's ajax function, and it defines a function success() that's triggered when the ajax call succeeds and a error() function that's triggered when the ajax call failed. The problem is: phplist merely prints "FAIL" in the response when the subscribe attempt fails, but the status code remains a 200. IMHO, the ajax form should not have to search for the string "FAIL" in the response in order to detect a failure. Instead, it should check the status code of the HTTP response from the server. This can be achieved, for example, by throwing an exception in PHP--which will make PHP return a 500 Internal Server Error. Here is the relevant code for handling ajax subscription queries on phplist's side: * https://github.com/phpList/phplist3/blob/7ec8ab78f215894c29da8e54ff9d7c41ffde64c6/public_html/lists/index.php#L242-L272 My recommendation is to add the line: throw new Exception( "Error: Subscribe attempt failed!" ); after the "echo 'FAIL';" line here: * https://github.com/phpList/phplist3/blob/7ec8ab78f215894c29da8e54ff9d7c41ffde64c6/public_html/lists/index.php#L270 | ||||
Tags | No tags attached. | ||||
related to | 0019525 | new | Provide error message when a subscribe page accessed via Ajax doesn't exist |