php.net |  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
Status: Closed Package: Date/time related
PHP Version: 5.3.3 OS: Ubuntu 10.04
Private report: No CVE-ID:
 [2010-08-30 12:50 UTC] camka at hot dot ee
Description:
------------
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:
---------------
<?php
class di extends DateInterval {
    public $unit = 1;
}

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


Expected result:
----------------
1

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-24 03:32 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2011-01-24 03:32 UTC] stas@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 14:02:33 2014 UTC