User tests: Successful: Unsuccessful:
Title |
|
Done @phproberto with zero-24@b3daa0b
Description | <h2>How to test</h2> <ul> <li>enable the profile plugin</li> <li>register a new user</li> <li>use as bithday date: 99-99-2014</li> <li>apply patch</li> <li>test again</li> <li>no date save to the database.</li> </ul><p>Tracker:<br><a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33720&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33720&start=0</a></p> | ⇒ | <h2>How to test</h2> <ul class="task-list"> <li>enable the profile plugin</li> <li>register a new user</li> <li>use as bithday date: 99-99-2014</li> <li>apply patch</li> <li>test again</li> <li>no date save to the database.</li> </ul><p>Tracker:<br><a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33720&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33720&start=0</a></p> |
An error of the type (for example)
"DateTime::__construct(): Failed to parse time string (99-99-1190) at position 0 (9): Unexpected character"
will not only happen when using the profile plugin, but any place we use calendar.
I guess we need a global error preventing saving any form with such error and reloading the page concerned.
Therefore I see no other easy solution than adding the error in date.php.
We already have many errors in the libraries.
We would simply have something like:
if (strtotime($date) === false)
{
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATE_ERROR_FORMAT'), 'error');
return;
}
And the new ini string in lib_joomla.ini
@infograf768 Yes but if we do this we get (after the first step with 99-12-2014) a PHP Warning like:
Warning: DateTime::setTimezone(): The DateTime object has not been correctly initialized by its constructor in JRoot\joomla\libraries\joomla\date\date.php on line 404
and
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in JRoot\joomla\libraries\joomla\date\date.php on line 301
The Warning / Error we send will also show.
So we need to initializ it. So we can use a combination of your and my solution. We send a error and change $date to 'now'.
But if we do this we can't stop the user registration. And if it is required to use a birthday this can trick by use a invalid date (that retrun to now).
Indeed. I also saw some issues when saving global configuration as the error displays there, i.e. we have to check is $date is not empty too.
i.e. we have to check is $date is not empty too.
hmm IIRC we have this included as "" (and NULL) is not valid by strtotime.
PR is still valid
Labels |
Removed:
?
|
Status | New | ⇒ | Pending |
Category | ⇒ | Plugins |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-10-16 12:35:48 |
Test: Works fine for me