php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65672 Broken classes inherited from DatePeriod
Submitted: 2013-09-14 01:32 UTC Modified: 2019-09-22 14:34 UTC
Votes:21
Avg. Score:4.2 ± 1.3
Reproduced:16 of 18 (88.9%)
Same Version:6 (37.5%)
Same OS:11 (68.8%)
From: hosiplan at gmail dot com Assigned: duncan3dc (profile)
Status: Closed Package: Date/time related
PHP Version: 7.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hosiplan at gmail dot com
New email:
PHP Version: OS:

 

 [2013-09-14 01:32 UTC] hosiplan at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/class.dateperiod
---

Classes inherited from DatePeriod class cannot use their declared properties

Test script:
---------------
<?php

class Period extends \DatePeriod
{
	public $test;
}

$p = new Period(new \DateTime('now'), new \DateInterval('P1Y'), new \DateTime('tomorrow'));
$p->test = FALSE;



Expected result:
----------------
no error

Actual result:
--------------
Fatal error: main(): Writing to DatePeriod properties is unsupported in 
period.phpt on line 9

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-29 14:44 UTC] info at vdespa dot de
I can confirm this bug. It seems to introduce a backward incompatibility and it seems not to be properly documented in the changelog.

Looks like trying to fix bug #53437 (Crash when using unserialized DatePeriod instance) generated this issue. (https://bugs.php.net/bug.php?id=53437)
 [2017-01-16 06:58 UTC] heiglandreas@php.net
-PHP Version: 5.5.3 +PHP Version: 7.1
 [2017-01-16 06:58 UTC] heiglandreas@php.net
Looks like this never actually worked[1], so it can't have been introduced by a bugfix…

[1] https://3v4l.org/0oIl7
 [2018-02-17 21:47 UTC] php at duncanc dot co dot uk
It looks like this was introduced in 5.3.27 / 5.4.17 when fixing bug 53437 (https://github.com/php/php-src/commit/0ee71557ffd285552659b6aa37ea236e3bad493f)
 [2018-10-02 10:51 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-10-02 10:51 UTC] cmb@php.net
I can confirm that this BC break has been introduced with commit
0ee7155[1].

[1] <http://git.php.net/?p=php-src.git;a=commit;h=0ee71557ffd285552659b6aa37ea236e3bad493f>
 [2019-09-22 14:34 UTC] duncan3dc@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: duncan3dc
 [2019-09-22 14:34 UTC] duncan3dc@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php

Fix available in 7.2.20 and 7.3.7
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC