Skip to content

Extending DateInterval changes public properties to private #3468

@othercorey

Description

@othercorey

Bug report

Accessing the public properties $f, $days and $invert of a class that extends DateInterval throws this error:

Access to private property $f of parent class DateInterval.

However, these properties have always been publicly accessible.

https://www.php.net/manual/en/class.dateinterval.php

Code snippet that reproduces the problem

https://3v4l.org/MkELZ

class NewInterval extends DateInterval
{
}

$i = new NewInterval('P1D');
$i->f = 0.1;
var_dump($i);

Expected output

I don't see any reason this should be considered private.

I am not sure where DateInterval properties are documented. There is a date.stub file, but that was added recently. Are properties defaulted to private or is there an actual mapping that is marking them private?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions