Bug #53439 [Asn]: DatePeriod does not expose any properties

From: Date: Sun, 09 Jan 2011 05:00:14 +0000
Subject: Bug #53439 [Asn]: DatePeriod does not expose any properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157770@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53439&edit=1

 ID:                 53439
 Updated by:         cataphract@php.net
 Reported by:        from dot php dot net at brainbox dot cz
 Summary:            DatePeriod does not expose any properties
 Status:             Assigned
 Type:               Bug
 Package:            Date/time related
 Operating System:   Windows XP SP3
 PHP Version:        5.3.3
-Assigned To:        cataphract
+Assigned To:        derick
 Block user comment: N
 Private report:     N

 New Comment:

Reassigning to Derick, as the patch I've written is under his
consideration.


Previous Comments:
------------------------------------------------------------------------
[2010-12-01 17:58:19] from dot php dot net at brainbox dot cz

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 this bug report at http://bugs.php.net/bug.php?id=53439&edit=1


Thread (7 messages)

« previous php.bugs (#157770) next »