Skip to content
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

Private property in extensible class AMP_Base_Sanitizer #3061

Open
schlessera opened this issue Aug 21, 2019 · 3 comments
Open

Private property in extensible class AMP_Base_Sanitizer #3061

schlessera opened this issue Aug 21, 2019 · 3 comments
Labels
P2 Low priority Sanitizers WS:Perf Work stream for Metrics, Performance and Optimizer
Projects

Comments

@schlessera
Copy link
Collaborator

The extensible class AMP_Base_Sanitizer has a private property $should_not_removed_nodes [sic].

It is being used in a public method remove_invalid_child(), and if an extending class would override this public method, for example by copying the source code over and making modifications, this might not behave as expected. Copying the code as is from the base method would create a separate, dynamic property with a lifetime independent of the original one, and the code would act either on one or the other, depending on what class it comes from.

Is the use of private intentional here? If yes, would it make sense to make the remove_invalid_child() final to make sure no one overrides it, introducing hard-to-diagnose bugs?

If not, it might make sense to turn the property from private to protected, so it behaves more consistently with regards to inheritance.

@westonruter
Copy link
Member

Good point. Yes, the method should be marked final.

As part of #2315 it may make sense for this to be protected when the method gets reincarnated.

@westonruter
Copy link
Member

westonruter commented Aug 21, 2019

The extensible class AMP_Base_Sanitizer has a private property $should_not_removed_nodes [sic].

By the way, do you have a problem with my command of the English language‽ 025d1bb 😉

@amedina
Copy link
Member

amedina commented Apr 1, 2020

@schlessera @westonruter it seems this is an easy fix? Can we go ahead with it?

@westonruter westonruter added the P2 Low priority label Apr 12, 2020
@kmyram kmyram added this to Backlog in Ongoing Jun 11, 2020
@kmyram kmyram added the WS:Perf Work stream for Metrics, Performance and Optimizer label Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Low priority Sanitizers WS:Perf Work stream for Metrics, Performance and Optimizer
Projects
Ongoing
  
Backlog
Development

No branches or pull requests

4 participants