php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74405 Undocumented 4th parameter of DateTime::setTime
Submitted: 2017-04-10 11:56 UTC Modified: 2017-08-12 00:58 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:1 of 3 (33.3%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: fabien dot villepinte at gmail dot com Assigned: ajf (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.1 OS:
Private report: No CVE-ID: None
 [2017-04-10 11:56 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-15 11:02 UTC] fabien dot villepinte at gmail dot com
-Type: Bug +Type: Documentation Problem -PHP Version: Irrelevant +PHP Version: 7.1
 [2017-04-15 11:02 UTC] 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-08-12 00:56 UTC] ajf@php.net
Automatic comment from SVN on behalf of ajf
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=342846
Log: Fix bug #74405 (Undocumented 4th parameter of DateTime::setTime)
 [2017-08-12 00:58 UTC] ajf@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ajf
 [2017-08-12 00:58 UTC] ajf@php.net
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.


 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of ajf
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=932a77838ba9e32787e4845fcad875d950199c5e
Log: Fix bug #74405 (Undocumented 4th parameter of DateTime::setTime)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 06:01:29 2024 UTC