? Success

User tests: Successful: Unsuccessful:

avatar zero-24
zero-24
11 May 2014

How to test

  • enable the profile plugin
  • register a new user
  • use as bithday date: 99-99-2014
  • apply patch
  • test again
  • now (the current date) save to the database.

Tracker:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33720&start=0

avatar zero-24 zero-24 - open - 11 May 2014
avatar zero-24 zero-24 - change - 11 May 2014
Title
Fix: Error in user registration with profile plugin enabled
[#33720] Fix: Error in user registration with profile plugin enabled
avatar n9iels
n9iels - comment - 11 May 2014

Test: Works fine for me

avatar zero-24
zero-24 - comment - 12 May 2014

Thanks @Bakual Codestyle should fixed now

Thanks @n9iels for your test :+1:

avatar zero-24
zero-24 - comment - 12 May 2014
avatar zero-24 zero-24 - change - 14 May 2014
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&amp;tracker_item_id=33720&amp;start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=33720&amp;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&amp;tracker_item_id=33720&amp;start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=33720&amp;start=0</a></p>
avatar infograf768
infograf768 - comment - 18 May 2014

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

avatar zero-24
zero-24 - comment - 18 May 2014

@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).

avatar infograf768
infograf768 - comment - 20 May 2014

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.

avatar zero-24
zero-24 - comment - 20 May 2014

@infograf768

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.

avatar zero-24
zero-24 - comment - 27 Jul 2014

PR is still valid

avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar brianteeman brianteeman - change - 23 Sep 2014
Category Plugins
avatar zero-24 zero-24 - close - 16 Oct 2014
avatar zero-24 zero-24 - close - 16 Oct 2014
avatar zero-24 zero-24 - head_ref_deleted - 16 Oct 2014
avatar zero-24 zero-24 - change - 16 Oct 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-16 12:35:48

Add a Comment

Login with GitHub to post a comment