This is not really a serious issue I think, just catching a corner case of user input really.
I was expecting some client side validation to alert me of the invalid input, or perhaps some server side validation.
I get an error message saying
DateTime::__construct(): Failed to parse time string (2017-02-07 012:25:10) at position 11 (0): Unexpected character
PHP Built On Linux 2.6.32-642.6.2.el6.x86_64 #1 SMP Wed Oct 26 06:52:09 UTC 2016 x86_64
Database Version 5.6.34
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.0.15
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.6.5 Stable [ Noether ] 1-December-2016 22:46 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
..and also...
PHP Built On Linux hp-i5 4.8.0-34-generic #36-Ubuntu SMP Wed Dec 21 17:24:18 UTC 2016 x86_64
Database Version 5.7.17-0ubuntu0.16.10.1
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.0.8-3ubuntu3
Web Server Apache/2.4.18 (Ubuntu)
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.6.4 Stable [ Noether ] 21-October-2016 16:33 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
This is the same for the "Start Publishing" and "Finish Publishing" fields, and is also the same in the Joomla front end.
I'll try and come up with a fix and a pull request.
Labels |
Added:
?
|
For JS we would need to have a rather complex function, what about handling this on save and outputting an error message using php?
Not only that, but should this be user input adjustable? Shouldn't it be selected from a calendar / time selector?
For JS we would need to have a rather complex function, what about handling this on save and outputting an error message using php?
Agreed. JS may be complex especially with different rules for different languages.
Not only that, but should this be user input adjustable?
Certainly yes. It's much faster to input a date using the keyboard than searching the date with a calendar popup. Especially if we're speaking about eg a day of birth.
I haven't had the time yet to debug this, but my first guess would be this line:
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/form.php#L1288 and https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/form.php#L1321
If that error can be catched (looks like an exception to me), then we can enqueue at least a message instead of that error. However that's only the filter here, I never tried what happens when you return "false" in the filtering step. I don't think it will create a validation error.
So I think we'd need an additional formrule which uses a similar approach?
I was thinking serverside validation rule for the field? Since catching the error at that point is too late I believe.
Category | ⇒ | com_content |
@Bakual close this Issue because #13974?
Status | New | ⇒ | Confirmed |
If people (eg @AndyGaskell) are fine with that solution, this can be closed.
As it has been 6 weeks since the last comment I am closing this on the assumption that the pull request was ok for everyone. it can always be reopened if required
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-21 15:02:00 |
Closed_By | ⇒ | brianteeman |
JS validation certainly would be nice.
I think it would also make sense to catch the error and display a nice error message instead (or at least a generic "invalid input" message)