Problem/Motivation
When submitting the admin form without 'Mapped path' the following php notice is given:
Warning: Invalid argument supplied for foreach() in adform_admin_settings_form() (regel 27 van /var/www/eyefilm/htdocs/sites/all/modules/contrib/adform/adform.admin.inc).
Further I noticed that the code assumes "\n" as line separator.
Proposed resolution
Make the user input more bullet proof.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | make_user_input-2875158-6.patch | 1.54 KB | xen |
| #4 | make_user_input-2875158-4.patch | 2.13 KB | xen |
| #2 | adform-admin-input-2875158-2.patch | 1.84 KB | sutharsan |
Comments
Comment #2
sutharsan commentedComment #3
sutharsan commentedComment #4
xen commentedHeh, funnily enough the issue was caused by a patch that tried to fix an issue that was probably caused by \r in the input.
But i think the issue can be fixed lighter, please try the attached patch.
Comment #5
sutharsan commentedPatch works fine.
However, I would not change the Hostnames separator behaviour, "... seperated by space or on seperate lines." (or not in this patch). When saving the hostnames, the space separator is replaced by a new line.
Comment #6
xen commentedOK, stepping back a minute. Have you actually run into issues with \r? No modern OS uses only \r for newline, and the trimming of the exploded lines in the original code should strip out extra \r making special handling unnecessary.
Try the attached patch which reverts the original "fix", especially if it handles an empty mapping OK.
Comment #7
sutharsan commentedNo, I have not ran into problems with \r. Apparently I'm repeating an old pattern, also in core (e.g. RequestPath) only \n is used.
The reason I worked on this code was to fix the problem that adform_mappings is stored as string (and not as empty array) when no mappings are entered.
RTBC again, thanks.
Comment #8
xen commentedFix committed. Release 1.2 should be available shortly.