?
avatar PhilETaylor
PhilETaylor
8 Oct 2020

Steps to reproduce the issue

Joomla 4 Admin Console
Redirects Component -> Options -> Enable Advanced Mode -> save
Redirects Component -> New

Set Redirect Status Code to string "Its2020AndStillJoomlaDoesntValidateInput"

Click Save.

Expected result

Validation exception. Redirect Status code should be something in 3xx range.

Actual result

No validation until the user supplied value hits the database layer and then a mysql error is displayed to the user:

Save failed with the following error: Incorrect integer value: 'Its2020AndStillJoomlaDoesntValidateInput' for column 'header' at row 1
Screenshot 2020-10-08 at 22 17 56

System information (as much as possible)

Additional comments

Also note that saving a redirect status code of 999 is validated as ok and the link saved :-(

Screenshot 2020-10-08 at 22 19 57

avatar PhilETaylor PhilETaylor - open - 8 Oct 2020
avatar joomla-cms-bot joomla-cms-bot - change - 8 Oct 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Oct 2020
avatar PhilETaylor PhilETaylor - change - 8 Oct 2020
The description was changed
avatar PhilETaylor PhilETaylor - edited - 8 Oct 2020
avatar PhilETaylor PhilETaylor - change - 8 Oct 2020
The description was changed
avatar PhilETaylor PhilETaylor - edited - 8 Oct 2020
avatar brianteeman
brianteeman - comment - 8 Oct 2020

I know how to partially fix this

		<field
			name="header"
			type="redirect"
			label="COM_REDIRECT_FIELD_REDIRECT_STATUS_CODE_LABEL"
			description="COM_REDIRECT_FIELD_REDIRECT_STATUS_CODE_DESC"
			default="301"
			filter="integer"
			validate="number"
		/>

But that just results in a 0 being saved when you try to save a string

avatar PhilETaylor
PhilETaylor - comment - 8 Oct 2020

and of course 0 is not a valid HTTP Status Code ;-)

avatar PhilETaylor
PhilETaylor - comment - 8 Oct 2020

and of course 0 is not a valid HTTP Status Code ;-) ... even though its sometimes used as an error code :)

avatar Llewellynvdm
Llewellynvdm - comment - 9 Oct 2020

This should not be hard to fix at all... but why say Its2020AndStillJoomlaDoesntValidateInput that is just not true.

@brianteeman is right that this is a partial fix, since as you may know Joomla can have its own special validation rule for any field, so there seems to be at least one simple option here... lol ?

  • We add a special validation rule for this field to insure that only valid HTTP status codes are used.

I see the code was worked on about three years ago... but I am sure more can be done. Tell me @PhilETaylor are you willing to push any code towards this should the Release Leads agree?

avatar SharkyKZ SharkyKZ - change - 9 Oct 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-10-09 07:22:09
Closed_By SharkyKZ
avatar SharkyKZ SharkyKZ - close - 9 Oct 2020
avatar SharkyKZ
SharkyKZ - comment - 9 Oct 2020

Please test PR #31016 (for staging).

Add a Comment

Login with GitHub to post a comment