You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table where I'm using timestampable behaviour - this is in the schema.xml
<behavior name="timestampable"></behavior>
The table contains user records and we have the fields below defined in the structure:
created_at datetime Yes NULL
updated_at datetime Yes NULL
The majority of staff uploading user records all work fine, however one particular user gets the following error. If I get this user to send me the file to upload I upload it and it works fine. Yet when they upload it they get this error.
[Wed Oct 23 22:14:53 2013] [error] [client 115.75.129.87] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character' in /home/sobs/build/classes/focus_sobs/om/BaseUser.php:1665\n
Stack trace:\n#0 /home/sobs/build/classes/focus_sobs/om/BaseUser.php(1665): DateTime->__construct('0')\n
#1 /home/sobs/build/classes/focus_sobs/om/BaseUser.php(1954): BaseUser->setUpdatedAt(1382530493)\n
#2 /home/sobs/build/classes/focus_sobs/UserPeer.php(676): BaseUser->save()\n
#3 /home/sobs/build/import3-content.php(124): UserPeer::import(Array, true, 861, false, false)\n
#4 /home/sobs/build/topline.php(302): include('/home/sobs/buil...')\n
#5 /home/sobs/build/pt/import3.php(9): include('/home/sobs/buil...')\n
#6 {main}\n thrown in /home/sobs/build/classes/focus_sobs/om/BaseUser.php on line 1665, referer: http://sobs.com.au/pt/import2.php
This staff member is in Vietnam yet we are both on the same server in Australia. The php.ini looks like:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Australia/Brisbane
Looking at the code in BaseUser.php
Line 1954: $this->setUpdatedAt(time());
And the function setUpdateAt()
public function setUpdatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->updated_at !== null || $dt !== null) {
Line 1665 $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->updated_at = $newDateAsString;
$this->modifiedColumns[] = UserPeer::UPDATED_AT;
}
} // if either are not null
return $this;
} // setUpdatedAt()
A value is being passed in here, however the $this->updated_at does not seem to have been populated, and neither is it null, but a '0', which causes the error in the DateTime constructor.
Perhaps we should test for 0 or null and do the same process.
The text was updated successfully, but these errors were encountered:
I have a table where I'm using timestampable behaviour - this is in the schema.xml
The table contains user records and we have the fields below defined in the structure:
created_at datetime Yes NULL
updated_at datetime Yes NULL
The majority of staff uploading user records all work fine, however one particular user gets the following error. If I get this user to send me the file to upload I upload it and it works fine. Yet when they upload it they get this error.
This staff member is in Vietnam yet we are both on the same server in Australia. The php.ini looks like:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Australia/Brisbane
Looking at the code in BaseUser.php
Line 1954: $this->setUpdatedAt(time());
And the function setUpdateAt()
public function setUpdatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->updated_at !== null || $dt !== null) {
Line 1665 $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->updated_at = $newDateAsString;
$this->modifiedColumns[] = UserPeer::UPDATED_AT;
}
} // if either are not null
return $this;
} // setUpdatedAt()
A value is being passed in here, however the $this->updated_at does not seem to have been populated, and neither is it null, but a '0', which causes the error in the DateTime constructor.
Perhaps we should test for 0 or null and do the same process.
The text was updated successfully, but these errors were encountered: