Unfortunately that didn't fix it for me.
I confirm the issue on staging
Thanks.
Actually this is 2 bugs, and both can effect other code and 3rd party extensions
Filtering types for 'SERVER_UTC' 'USER_UTC'
do not use try-catch, in
libraries\joomla\form\form.php
// Return an SQL formatted datetime string in UTC.
$return = JFactory::getDate($value, $offset)->toSql();
should (probably) be
// Return an SQL formatted datetime string in UTC.
try {
$return = JFactory::getDate($value, $offset)->toSql();
} catch (Exception $e) {
$return = '';
}
Similar the getInput() of calendar field (dob element extends calendar element)
on form-reload after validation will be given to display the invalid date that was posted
libraries\joomla\form\fields\calendar.php
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');
$date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
// Transform the date string.
$this->value = $date->format('Y-m-d H:i:s', true, false);
should (probably) be
try {
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');
$date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
// Transform the date string.
$this->value = $date->format('Y-m-d H:i:s', true, false);
} catch (Exception $e) {
$this->value = '';
}
i can not do a pull request now,
but anyone else can do and also confirm fix,
and do whatever more is needed
and each of the above is needed in 2 places, (for both 'SERVER_UTC' and 'USER_UTC')
Thanks for your assessment of this issue.
Now forgive me, I'm not a Joomla contributor, just some schmoe trying to use it... but I've implemented the changes you're suggesting into my development work and this doesn't seem like the correct solution to me. Instead of resulting in the expected validation error, "Registration failed: The date of birth you entered is invalid. Please enter valid date.", this is instead resulting in a simple warning, "Field required: Date of Birth:", and resetting the entered date to today's date, which obfuscates the issue being that the user entered an invalid date. Therefore this doesn't really accomplish the correct fix that would be consistent with Joomla, in my opinion.
I will admit that I'm not very familiar with the form validation architecture to have any better idea of how this should be addressed, so I'm not really helpful in knowing what the correct solution would be... but surely the ideal fix is obvious to someone who's well-versed in this part of the system, no?
That is not relevant to my suggested fix.
The fix is needed,
e.g. in our case the DOB field can see that
again that is extra code, that needs to be done extra to the suggested fix
I am not sure where that code should be,
because i have not looked at it more,
maybe it is not inside the code of the field, maybe inside the JForm class
Possibly,
this is a 3rd issue with JForm, if filtering empties a value then form validation will wrongly report it as empty ?
public function validate($form, $data, $group = null)
{
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data, $group);
the validate function does not have access to the original posted data, maybe filtering can return false to indicate invalid field ?
Maybe the Exception could also throw an enqueueMessage?
Yes, that sounds like a good option
should set both
Just the user will get 2 messages:
but actually that is another issue ?
error messaging in validating code needs to account for this
can we set $return in filtering to false
and validating will not set an error message if
$value===false
Please see and test #8656
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-01-28 11:46:36 |
Closed_By | ⇒ | brianteeman |
Closed as we have a PR
Looks like this is happening again, on MacOSX.
Please try #7849 it should fix the issue with the next update to 3.4.5