Doc #74405 [Opn->Csd]: Undocumented 4th parameter of DateTime::setTime
| From: | ajf@php.net | Date: | Sat, 12 Aug 2017 00:58:13 +0000 |
| Subject: | Doc #74405 [Opn->Csd]: Undocumented 4th parameter of DateTime::setTime | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14890@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74405&edit=1
ID: 74405
Updated by: ajf@php.net
Reported by: fabien dot villepinte at gmail dot com
Summary: Undocumented 4th parameter of DateTime::setTime
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.1
-Assigned To:
+Assigned To: ajf
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2017-08-12 00:56:41] ajf@php.net
Automatic comment from SVN on behalf of ajf
Revision: http://svn.php.net/viewvc/?view=revision&revision=342846
Log: Fix bug #74405 (Undocumented 4th parameter of DateTime::setTime)
------------------------------------------------------------------------
[2017-04-15 11:02:39] fabien dot villepinte at gmail dot com
This new parameter has been added in PHP 7.1:
https://github.com/php/php-src/commit/55626549d81d0feadb1d160be78fcf2b898a48cc#diff-7b738accc3d60f74c259da18588ddc5dR3421
but the documentation has not been updated accordingly.
------------------------------------------------------------------------
[2017-04-10 11:56:28] fabien dot villepinte at gmail dot com
Description:
------------
According the documentation the methods DateTime::setTime and DateTimeImmutable::setTime have 3
parameters, but by using reflection we can see there is a 4th parameter ("microseconds").
http://php.net/manual/en/datetime.settime.php
http://php.net/manual/en/datetimeimmutable.settime.php
Test script:
---------------
<?php
$rm = new ReflectionMethod(DateTime::class, "setTime");
printf("%d\n%d\n", $rm->getNumberOfParameters(),
$rm->getNumberOfRequiredParameters());
foreach ($rm->getParameters() as $param) {
printf("Parameter #%d (%s) %s OPTIONAL\n", $param->getPosition(),
$param->getName(), $param->isOptional() ? "IS" : "IS NOT");
}
Actual result:
--------------
4
2
Parameter #0 (hour) IS NOT OPTIONAL
Parameter #1 (minute) IS NOT OPTIONAL
Parameter #2 (second) IS OPTIONAL
Parameter #3 (microseconds) IS OPTIONAL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74405&edit=1