Bug #55407 [Opn]: Impossible to prototype DateTime::createFromFormat
| From: | pierrick@php.net | Date: | Thu, 11 Aug 2011 23:14:28 +0000 |
| Subject: | Bug #55407 [Opn]: Impossible to prototype DateTime::createFromFormat | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162528@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55407&edit=1
ID: 55407
Updated by: pierrick@php.net
Reported by: landeholm at gmail dot com
Summary: Impossible to prototype DateTime::createFromFormat
Status: Open
Type: Bug
-Package: Scripting Engine problem
+Package: Date/time related
Operating System: Irrelevant
PHP Version: 5.3.6
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
The method signature is in fact :
createFromFormat($format, $time, $timezone = null);
Assign this to derick to confirm that we need to change the documentation to
reflect the real method signature (or the opposit ?)
Previous Comments:
------------------------------------------------------------------------
[2011-08-11 20:52:14] landeholm at gmail dot com
Here is the related commit (adding the class above):
https://github.com/melt/melt/commit/4c08b7e65ad9a3dbf165768b0fa55a99862cf910
Here is my temporary workaround:
https://github.com/melt/melt/commit/25c295fd86a52f84f18777814d7efaa8cf372fd6
------------------------------------------------------------------------
[2011-08-11 20:10:00] landeholm at gmail dot com
Description:
------------
Hello,
I'm creating an extended DateTime for my framework. The test script below gives "E_STRICT:
Declaration of melt\core\DateTime::createFromFormat() should be compatible with that of
DateTime::createFromFormat()" even though it's declared exactly as documented.
Also removing all the arguments what so ever doesn't make this problem go away so it's
impossible to prototype DateTime::createFromFormat without getting this error.
Test script:
---------------
<?php namespace melt\core;
class DateTime extends \DateTime {
public static function createFromFormat($format, $time, DateTimeZone $timezone = null) {
return new DateTime(parent::createFromFormat($format, $time, $timezone));
}
}
Expected result:
----------------
The class being declared as it should.
Actual result:
--------------
E_STRICT: Declaration of melt\core\DateTime::createFromFormat() should be compatible with that of
DateTime::createFromFormat()
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55407&edit=1