Skip to content

Deprecate Soft-deprecated DOMDocument and DOMEntity properties #15369

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

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

kocsismate
Copy link
Member

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me, will wait for Niels to confirm.

@Girgias
Copy link
Member

Girgias commented Aug 13, 2024

Niels has let me know that he's in the USA for a week, so let's merge it before beta1 and if there are issues we can always amend the implementation

@Girgias Girgias merged commit 587110c into php:master Aug 13, 2024
10 checks passed
@kocsismate kocsismate deleted the deprecate-dom-properties branch August 13, 2024 12:26
@nielsdos
Copy link
Member

Just checking this out quickly on my phone. The code seems right, however note that doing var_dump on a dom document will now emit deprecation warnings for the properties as well. Idk if this is desired and/or consistent with other deprecated properties.

@kocsismate
Copy link
Member Author

@nielsdos thanks for checking it even on a phone! I think we should not emit deprecations during var_dumping... I'm wondering though what the best fix would be... but it's a tough question. :/ Maybe adding a bool silent parameter to read functions? This may be the cleanest, but the most pervasive solution I can come up with. Do you have any better suggestion?

@nielsdos
Copy link
Member

@kocsismate Adding a bool silent parameter is indeed a possibility. What I don't like about it is that, as you already hinted, we need to modify all handlers for a parameter which won't be used in the majority of cases.

Another possibility is to add a module global variable to silence deprecations. Set it to true in the debug object handler, and reset it to false once that handler finishes. Then just check the global in the relevant read handlers.
This works because the debug object handler won't be re-entered.

@kocsismate
Copy link
Member Author

@nielsdos My original idea was to disable emitting warnings, similarly how warnings can be converted to exceptions, but since I didn't find an existing solution, I gave up the idea.

Besides, my other idea was along the lines of the global-based approach as you mentioned, but I neither liked this, since it required extending global state. However, I guess this is still acceptable, especially that it's a temporary solution for a few years. So if you are also OK, then I'll do the followup soon.

@nielsdos
Copy link
Member

Global-based approach is fine for me as it's temporary anyway.

@kocsismate
Copy link
Member Author

filed #15530 to fix the behavior

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.

3 participants