[wp-trac] [WordPress Trac] #38133: Widget output empty if input is zero

WordPress Trac noreply at wordpress.org
Thu Sep 22 19:52:56 UTC 2016


#38133: Widget output empty if input is zero
----------------------------+-----------------------------
 Reporter:  hardeepasrani   |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Widgets         |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 If you put a single zero 0 in default widgets, it won't output any thing.
 You can try putting a 0 in any widget title or content. It works if you
 put 00 or anything else.

 The reason being our use of `empty( $variable )` and `! empty( $variable
 )` in the default widgets. `empty` returns FALSE if var exists and has a
 non-empty, non-zero value.

 So it will be better to use `isset( $variable) && $variable != ''`
 instead. Wanted to submit a patch but wanted to know if above method will
 be the best one.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38133>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list