[wp-trac] [WordPress Trac] #55161: Full Site Editing: PHP Warning with incomplete presets

WordPress Trac noreply at wordpress.org
Wed Feb 16 21:20:53 UTC 2022

#55161: Full Site Editing: PHP Warning with incomplete presets
 Reporter:  jeherve                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  5.9.1
Component:  Editor                   |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  administration

Comment (by jrf):

 Replying to [comment:2 SergeyBiryukov]:
 > Replying to [comment:1 swissspidy]:
 > > you can just combine the `isset()` calls like so:
 > >
 > > `isset( $preset_metadata['value_key'], $preset[
 $preset_metadata['value_key'] ] )`
 > Technically true, but that doesn't seem to be a common pattern in core,
 we seem to generally check multiple values separately.
 [attachment:"55161.diff"] looks a bit more readable to me as is :)

 The fact that it's not used much in Core is no reason not to use it. I
 concur with @swissspidy that doing the check in one call to `isset()` is
 more efficient and is a good pattern to introduce in Core.

Ticket URL: <https://core.trac.wordpress.org/ticket/55161#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list