?
Referenced as Pull Request for: # 7849
avatar pe7er
pe7er
9 Sep 2015

In Joomla forum I've seen two reports (http://forum.joomla.org/viewtopic.php?f=706&t=894331) of people getting the following error after upgrading to Joomla 3.4.4:

DateTime::__construct(): Failed to parse time string (Never) at position 0 (N): The timezone could not be found in the database

In both cases it was caused by a 3rd party extension: Flexicontent (seem to have fixed in their v3.0.8) & iJoomla Guru.

avatar pe7er pe7er - open - 9 Sep 2015
avatar ggppdk
ggppdk - comment - 9 Sep 2015

Yes FLEXIcontent has fixed this error in v3.0.8

About the error, there is a behaviour change in
JForm form element -calendar-
libraries\form\fields\calendar.php

  • it will no longer check if value starts with -number-, thus you can not set a text in the field, in previous version, it did the above by typecasting to the value to integer before passing it to

JFactory::getDate(-value-), which in turn will pass it to PHP DateTime(),
which will throw an exception, that is not caught by the form element (no change in behaviour here, the calendar form element lets the exception propagate up without catching it)

  • i guess this change was done because there are dates that start with letters ? so this change was necessary ?
avatar pe7er
pe7er - comment - 9 Sep 2015

Thank you for your reply with explanation what has been fixed in FLEXIcontent @ggppdk
This might be very useful for other developers that run into this DateTime::__construct() error.

avatar mbabker
mbabker - comment - 9 Sep 2015

The method was typecasting the injected value as an integer which meant you couldn't use string date notations in that method, so that change was needed. For implementations like what I saw in FLEXIcontent which stored values that shouldn't have been accepted for the field types using that behavior (from what I saw, you were saving a "Never" string to fields that looked to be date/time fields), it did cause a break by not letting the invalid value slip by. So, yes there was a small B/C break to allow additional data in the method at the expense of throwing errors on invalid data formats.

avatar joomdonation
joomdonation - comment - 9 Sep 2015

Made a quick PR #7849 to prevent issue like that happens in the future.

avatar pe7er
pe7er - comment - 9 Sep 2015

Thanks @mbabker & @joomdonation !

avatar ggppdk
ggppdk - comment - 9 Sep 2015

In FLEXIcontent it is not really necessary to be able to set an (invalid date) text value and then submit it too.

thus we removed it, still it is a change in behaviour inside a minor Joomla version update

I don't know if other extensions do need to set (invalid date) text values on JForm load to the calendar field

avatar zero-24 zero-24 - change - 10 Sep 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-09-10 05:11:41
Closed_By zero-24
avatar zero-24 zero-24 - close - 10 Sep 2015
avatar zero-24
zero-24 - comment - 10 Sep 2015

Closing as we have A PR above by @joomdonation

avatar zero-24 zero-24 - close - 10 Sep 2015
avatar Paulo7P7
Paulo7P7 - comment - 18 Oct 2015

for Guru:
administrator/components/com_guru/views/guruprograms/tmpl

find:
echo JHTML::_('calendar', $end_publish, 'endpublish', 'endpublish', $format, array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>

and change

echo JHTML::_('calendar', null, 'endpublish', 'endpublish', $format, array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>

avatar mttronc mttronc - reference | 650ace9 - 24 Oct 15
avatar inter-web
inter-web - comment - 7 Mar 2016

Thank your very much Paulo7P7 !

Excellent contribution ;)

avatar inter-web
inter-web - comment - 15 Mar 2016

Hi Paulo7P7

You will know how to solve this problem Guru 4.0.7 => #9431

Thank you in advanced!

Add a Comment

Login with GitHub to post a comment