From:
Operating system: Windows XP SP3
PHP version: 5.3.3
Package: Date/time related
Bug Type: Bug
Bug description:DatePeriod does not expose any properties
Description:
------------
The DatePeriod instance does not expose its internal properties, thus makes
impossible to extend the class.
The properties are not visible in the reflection as well. Also, when I cast
the instance to array (which usually exposes all properties), no props are
shown.
The draft of the test follows.
Test script:
---------------
$dp = new DatePeriod(new DateTime('2010-01-01'), new DateInterval('P1D'),
2);
$r = new ReflectionObject($dp);
$arr = (array)$dp; // cast to array to see the values of propeties
echo "Properties:\r\n";
foreach($r->getProperties() as $v) {
echo $v->getName()."\r\n";
}
echo "\r\n";
echo "Methods:\r\n";
foreach($r->getMethods() as $v) {
echo $v->getName()."\r\n";
}
echo "\r\n";
echo "Array cast:\r\n";
echo strtr(print_r($arr, true), "\0", '_');
Expected result:
----------------
Properties:
any_valid_properties...
...listed_here_after_implementing
Array cast:
Array
(
any_valid_properties...
...listed_here_after_implementing
)
Actual result:
--------------
Properties:
Array cast:
Array
(
)
--
Edit bug report at http://bugs.php.net/bug.php?id=53439&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53439&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53439&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53439&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53439&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53439&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53439&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53439&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53439&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53439&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53439&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53439&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53439&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53439&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53439&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53439&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53439&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53439&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53439&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53439&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53439&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53439&r=mysqlcfg