Skip to main content
Topic: XML/RSS News -- Odd error checking behavior (Read 1220 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

XML/RSS News -- Odd error checking behavior

News and Newsletters>Settings: section Enable XML/RSS news.

When enabling this section and entering non numeric values such as 'aaa' into the 'Maximum message length' and 'XML/RSS Limit', those values can successfully be saved. When clicking on the Save button, no error checking for correct type seem to occur.   You can now leave that page, move about the site and return and will find the 'aaa' values still entered.

However, if after entering and saving the 'aaa' values, you can click on the ? help icon and the help box will display. You will see a link for 'Recent News'. Clicking on that link will now produce the error box displayed in the below attachement. That error indicates a wrong type entered. I would not think the help box would do the type validation.

Now, to add more odd behavior, you can now go back and change the value to numeric and save them successfully. If you then go and change the numeric values back to 'aaa', clicking on 'save' will now produce the below error box again. Any non numeric entry at this time will always produce the type error box. Logging out and back in will permit the same chain of events to repeat itself in regards to starting the same process from the beginning again.

I would think the type validation would occur immediately upon the first saving of the value.

Sorry if that was confusing. I did try to make it clear.  :)

Re: XML/RSS News -- Odd error checking behavior

Reply #1
Yup, missing validation.
In ManageNews.controller.php (admin directory):
Code: (find) [Select]
				array('text', 'xmlnews_maxlen', 'subtext' => $txt['xmlnews_maxlen_note'], 10),
array('text', 'xmlnews_limit', 'subtext' => $txt['xmlnews_limit_note'], 10),

Code: (replace with) [Select]
				array('int', 'xmlnews_maxlen', 'subtext' => $txt['xmlnews_maxlen_note'], 10),
array('int', 'xmlnews_limit', 'subtext' => $txt['xmlnews_limit_note'], 10),

Pushed here:
Bugs creator.
Features destroyer.
Template killer.

Re: XML/RSS News -- Odd error checking behavior

Reply #2
Yep, that fixed it.  :)