|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52738 Can't use new properties in class extended from DateInterval
Submitted: 2010-08-30 12:50 UTC Modified: 2011-01-24 03:32 UTC
From: camka at hot dot ee Assigned: stas (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3.3 OS: Ubuntu 10.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 - 7 = ?
Subscribe to this entry?

 [2010-08-30 12:50 UTC] camka at hot dot ee
When trying to set or get any pre-defined property other then y/m/d/h/i/s in a class extended from built-in DateInterval, the error tells you that the property is not known.

Also tried with 
PHP 5.3.4-dev (cli) (built: Aug 30 2010 13:48:30) 

Test script:
class di extends DateInterval {
    public $unit = 1;

$I = new di('P10D');
echo $I->unit;

Expected result:

Actual result:
Fatal error: main(): Unknown property (unit) in /var/www/test/inter.php on line 7


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-24 03:32 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2011-01-24 03:32 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 20:01:30 2024 UTC