View Issue Details

IDProjectCategoryView StatusLast Update
0019524phpList 3 applicationGeneralpublic26-07-19 12:57
Reportermaltfield Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version3.3.6Fixed in Version3.3.6 
Summary0019524: return error code on FAIL in ajax subscribe
DescriptionThis 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:


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:


My recommendation is to add the line:

    throw new Exception( "Error: Subscribe attempt failed!" );

after the "echo 'FAIL';" line here:

TagsNo tags attached.


related to 0019525 new Provide error message when a subscribe page accessed via Ajax doesn't exist 



02-11-18 19:53

reporter   ~0061320

I created a PR request for this here: