Skip to content

Fix GH-11310: __debugInfo() does nothing on classes extending DateTime #12534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paulfedorow
Copy link

@paulfedorow paulfedorow commented Oct 27, 2023

Fixes GH-11310. Makes the __debugInfo method work in classes that extend DateTime and DateTimeImmutable.

  • Implemented __debugInfo for DateTime and DateTimeImmutable.
  • Modified the get_properties_for handlers of DateTime and DateTimeImmutable to invoke __debugInfo.

@paulfedorow paulfedorow requested a review from derickr as a code owner October 27, 2023 07:06
@paulfedorow paulfedorow marked this pull request as draft October 27, 2023 08:09
@paulfedorow paulfedorow marked this pull request as ready for review October 27, 2023 09:10
…Time

Makes the `__debugInfo` method work in classes that extend `DateTime`
and `DateTimeImmutable`.

* Implemented `__debugInfo` for `DateTime` and `DateTimeImmutable`.
* Modified the `get_properties_for` handlers of `DateTime` and
  `DateTimeImmutable` to invoke `__debugInfo`.
Copy link
Member

@derickr derickr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not needed for the other Date classes?

@@ -344,6 +344,9 @@ public function __serialize(): array {}

public function __unserialize(array $data): void {}

/** @tentative-return-type */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this have @tentative-return-type?

@paulfedorow paulfedorow requested a review from kocsismate as a code owner April 15, 2024 15:43
@prescriptionlifeline
Copy link

Any update on this?

@kocsismate
Copy link
Member

@paulfedorow Could you please rebase + update your PR according to Derick's comment? Since it seems like a useful fix (btw the same inconsistency exists in other places), so I'll finish it if you don't have time for this anymore.

}
}

class MyDateTimeZone extends DateTimeZone {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest adding a test case for MyDateTimeZone, otherwise why define the class at all?

@DanielEScherzer
Copy link
Member

Note that my patch at #16333 should fix this in a more general way

@paulfedorow
Copy link
Author

I'm closing this in favor of the more general fix provided in #16333

@DanielEScherzer
Copy link
Member

I'm closing this in favor of the more general fix provided in #16333

Actually my comment may have been a bit premature, it seems that my more general approach may not be desirable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__debugInfo() does nothing on classes extending DateTime
7 participants