[wp-trac] [WordPress Trac] #37890: `WP_Customize_Manager::prepare_setting_validity_for_js()` assumes `$error_data` is array

WordPress Trac noreply at wordpress.org
Fri Sep 2 04:02:17 UTC 2016


#37890: `WP_Customize_Manager::prepare_setting_validity_for_js()` assumes
`$error_data` is array
--------------------------+--------------------------
 Reporter:  dlh           |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.7
Component:  Customize     |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+--------------------------

Comment (by dlh):

 @westonruter [attachment:37890.2.diff] looks good to me. While I don't
 have a real-world case to hand that I could test against the change to
 `from_server`, I agree with you generally about not mutating the error
 data.

 One other thing I noticed while testing the patch: `$data` is optional in
 `WP_Error::add()`, but, in practice, it seems like the Customizer
 sometimes requires it because it compares the `data` property in JS before
 determining whether the notification `needsReplacement`. Just adding a
 different `$message` to the `WP_Error` isn't enough to replace the
 notification if `$code` is unchanged and  `$data` is a blank string each
 time (or the same of whatever value).

 Again, not a huge issue, and it might be intentional -- just took me a
 minute to realize why my error message wasn't changing.

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


More information about the wp-trac mailing list