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

Issue Type: Bug Created: 2009-05-29T07:58:37.000+0000 Last Updated: 2009-07-03T07:15:19.000+0000 Status: Resolved Fix version(s): - 1.8.3 (09/Jun/09)

Reporter: Ashley Kitson (akzincdig) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

Related issues: - ZF-7188



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.


Posted by Thomas Weidner (thomas) on 2009-05-29T08:51:05.000+0000

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.

Posted by Ashley Kitson (akzincdig) on 2009-06-01T23:58:14.000+0000

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 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.

Posted by Thomas Weidner (thomas) on 2009-06-05T16:04:26.000+0000

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.

Posted by Thomas Weidner (thomas) on 2009-06-06T01:07:54.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.