Bug #74706 [NEW]: Invalid Reflection signatures for various methods, e.g. DateTime::__set_state
| From: | tandre at themeetgroup dot com | Date: | Thu, 08 Jun 2017 05:31:34 +0000 |
| Subject: | Bug #74706 [NEW]: Invalid Reflection signatures for various methods, e.g. DateTime::__set_state | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209413@lists.php.net to get a copy of this message | ||
From: tandre at themeetgroup dot com
Operating system:
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:Invalid Reflection signatures for various methods, e.g. DateTime::__set_state
Description:
------------
DateInterval::__set_state, DateTimeImmutable::__set_state,
DateTime::__set_state, and DateTimeZone::__set_state all have
getNumberOfParameters() == 0 for their ReflectionMethod instances
Additionally, the function 'datefmt_set_lenient' seems to have incorrect
ReflectionFunction data: it says it has 1 required parameter, but should
say 2 required parameters
Test script:
---------------
// https://3v4l.org/jEmee for the full test script
$classes = array('DateInterval', 'DateTimeImmutable', 'DateTime',
'DateTimeZone');
foreach ($classes as $class){
echo "Signature of $class::_set_state\n";
try{
$rm = new ReflectionMethod($class, '__set_state');
var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
} catch(Exception $e) {
echo "$class: " . $e;
}
}
echo "End of param counts for __set_state\n\n";
var_export(DateTime::__set_state(array(
'date' => '2017-06-08 05:11:40.907706',
'timezone_type' => 3,
'timezone' => 'UTC',
)));
// DateTime::__set_state(); // would trigger Warning:
DateTime::__set_state() expects exactly 1 parameter, 0 given in php
shell code on line 1
// See 3v4l link for rest of script
Expected result:
----------------
Reflection counts should be 1 required, 1 total parameter for those
__set_state functions.
ReflectionFunction for datefmt_set_lenient should have 2 required, 2
total parameters
Actual result:
--------------
Reflection counts say 0 required, 0 total parameter for those
__set_state functions.
ReflectionFunction for datefmt_set_lenient currently shows 1 required, 1
total parameter
--
Edit bug report at https://bugs.php.net/bug.php?id=74706&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74706&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74706&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74706&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74706&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74706&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74706&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74706&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74706&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74706&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74706&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74706&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74706&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74706&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74706&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74706&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74706&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74706&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74706&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74706&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74706&r=mysqlcfg