ZF-7188: getDate() expects parameter 1 to be long, string given in DateObject.php line 667


Alias : ZF-7185 and ZF-6859

By looking better, the problem is that getUnixTimestamp() (class DateObject) send an empty string when this-> _ unixTimestamp equals null, while getdate() waits null value and not empty string.

A correction which I propose is simple. It is enough to add a line in getUnixTimestamp() , which becomes:

    protected function getUnixTimestamp()
        if($this->_unixTimestamp === null) return null;

        if ($this->_unixTimestamp === intval($this->_unixTimestamp)) {
            return (int) $this->_unixTimestamp;
        } else {
            return (string) $this->_unixTimestamp;


This issue duplicates two issues. If you believe there's still an issue (with the latest version, 1.8.4) please reopen one of these issues instead of creating a new one.

Closing this one as duplicate.