Zend Framework

Constructing Zend_Date with custom session savehandler causes Zend_Session_Exception

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.8.4
  • Fix Version/s: 1.9.0
  • Component/s: Zend_Date
  • Labels:
    None

Description

It appears that a suppressed warning when constructing a date from an existing date string inside a custom session savehandler causes Zend_Session to throw an exception.

Zend_Session_Exception: Zend_Session::start() - /ZendFramework-1.8.4PL1/library/Zend/Date/DateObject.php(Line:667): Error #2 getdate() expects parameter 1 to be long, string given Array in /ZendFramework-1.8.4PL1/library/Zend/Session.php on line 444

On line 179 of Zend_Date's constructor $this->getGmtOffset() is called which in turn calls $date = $this->getDateParts($this->getUnixTimestamp(), true);

$this->getUnixTimestamp() returns a string which is passed to getDateParts

The following warning is then suppressed on the call to return @getdate($timestamp);
Warning: getdate() expects parameter 1 to be long, string given in /ZendFramework-1.8.4PL1/library/Zend/Date/DateObject.php on line 667

The warning still causes Zend_Session to throw an exception (Due to its handling of errors).

This is a simplified version of my savehandler to reproduce the problem.

Class My_Session_SaveHandler_Memcached implements Zend_Session_SaveHandler_Interface
{
public function open($save_path, $name)
{
}

public function close()
{
}

public function read($id)

{ $date = new Zend_Date('2009-07-27 02:31:47', Zend_Date::ISO_8601); }

public function write($id, $data)
{ return true; }

public function destroy($id)
{
}

public function gc($maxLifetime)
{ return true; } }
}

Activity

Hide
Thomas Weidner added a comment -

Duplicate of ZF-7188

Show
Thomas Weidner added a comment - Duplicate of ZF-7188

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: