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

Description

Just upgraded to v1.8.2 from 1.7.5 and I am getting error (debug warning in Zend studio) ---/DateObject.php line 667 - getdate() expects parameter 1 to be long, string given Running through the debugger; $timestamp is a zero length string. The line before 667 is looking for a null timestamp in which case it would return the current time via getdate(). Perhaps the code needs changing to check for zero length string as well ?

The code that creates this condition is:

$dValue = '2009-04-14'; //or any date string $d = new Zend_Date($dValue); $value = $d->get(Zend_Date::DATE_SHORT);

The returned $value is as expected so as per priority this is a minor one.

Comments

Which php release ? Which OS ? Which locale has been used ? Which timezone has been set ? Is this just a warning in your debugger or a warning thrown by PHP ?

The null-check is ONLY done when the object is initiated. In this case a null is given. In any other case the timestamp is a integer. Only when it extends integer it's a string but this case is checked by the abs method.

Zend Core Version 2.5.0 PHP Version 5.2.4 Zend Engine Version 2.2.0 Server Software Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8d Zend Core/2.5.0 PHP/5.2.4 OS Version Linux zincdev.co.uk 2.6.18-128.1.10.el5 #1 SMP Wed Apr 29 13:53:08 EDT 2009 x86_64 (i.e. Redhat Enterprise 5)

locale = en_gb timezone = gmt

As per orig. post, it is a warning in the debugger.

Issue not reproducable. As we code strict and this failure does not pop up when running the example code it seems that this is a problem of the debugger and not ZF itself.

Otherwise the code would also throw an warning without the debugger (strict usage). Therefor this issue is closed as won't fix.

Fixed with r15909 even if not reproducable (Redhat or Debugger only problem)