[wp-trac] [WordPress Trac] #30891: Unchecked property overloading is detrimental to OOP.

WordPress Trac noreply at wordpress.org
Sun Jan 11 01:34:46 UTC 2015


#30891: Unchecked property overloading is detrimental to OOP.
--------------------------+------------------
 Reporter:  aercolino     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.2
Component:  General       |     Version:  4.0
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------

Comment (by boonebgorges):

 Replying to [comment:16 wonderboymusic]:
 > In [changeset:"31137"]:
 > {{{
 > #!CommitTicketReference repository="" revision="31137"
 > In `Walker`:
 >
 > * Every subclass of `Walker` overrides `$db_fields` and makes it public
 > * `wp_list_comments()` accesses `->max_pages` on an instance of
 `Walker`, it must be public
 > * `$has_children` was added as `protected` in 4.0. doesn't need BC
 >
 > Make `$db_fields` and `$max_pages` public and remove magic methods.
 >
 > See #30891.
 > }}}

 After [31137], `Tests_Comment_Walker::test_has_children()` is throwing a
 fatal error, because `$has_children` is no longer accessible. It's
 possible to rewrite the test to account for a protected property like
 this, but I'm wondering if this property might be accessed in the wild.
 Just because the docs said that the property is protected in 4.0 doesn't
 mean that people aren't accessing it. I suggest making it public, or
 reintroducing a magic method with a whitelist for `has_children`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30891#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list