Bug #74405 [NEW]: Undocumented 4th parameter of DateTime::setTime
| From: | fabien dot villepinte at gmail dot com | Date: | Mon, 10 Apr 2017 11:56:29 +0000 |
| Subject: | Bug #74405 [NEW]: Undocumented 4th parameter of DateTime::setTime | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14603@lists.php.net to get a copy of this message | ||
From: fabien dot villepinte at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Bug
Bug description:Undocumented 4th parameter of DateTime::setTime
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 bug report at https://bugs.php.net/bug.php?id=74405&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74405&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74405&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74405&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74405&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74405&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74405&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74405&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74405&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74405&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74405&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74405&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74405&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74405&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74405&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74405&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74405&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74405&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74405&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74405&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74405&r=mysqlcfg