[wp-trac] [WordPress Trac] #38630: Discourage usage of legacy properties in WP_Site

WordPress Trac noreply at wordpress.org
Mon Apr 3 21:39:46 UTC 2017


#38630: Discourage usage of legacy properties in WP_Site
-----------------------------------+------------------------
 Reporter:  flixos90               |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  4.8
Component:  Networks and Sites     |     Version:  4.5
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  multisite
-----------------------------------+------------------------

Comment (by flixos90):

 [attachment:38630.3.diff] brings a few improvements over the previous
 patch:

 * In the `to_array()` method, it is ensured that the legacy properties are
 strings.
 * The `$id` and `$network_id` properties are no longer handled in the
 `__get()` and `__isset()` methods since they are public anyway. They are
 however still part of `__set()` since this method is called manually in
 the constructor.

 Looking at the unit tests, I'm wary of this change although I definitely
 like its approach. Most unit tests failures (there are several) are only a
 result of the deprecation of `to_array()` which we can easily adjust, but
 the other two failures are actual failures, so anyone using
 `get_object_vars()` on `WP_Site` objects or iterating over them would run
 into problems (see https://core.trac.wordpress.org/ticket/40180#comment:3
 for background). I'm starting to think we should hold off changing the
 public properties, although I don't like to say it.

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


More information about the wp-trac mailing list