[wp-trac] [WordPress Trac] #42887: variable assignment in if statement

WordPress Trac noreply at wordpress.org
Wed Dec 13 01:12:18 UTC 2017


#42887: variable assignment in if statement
--------------------------+-----------------------------
 Reporter:  freetheweb    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  4.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I saw this page: https://github.com/WordPress/WordPress/blob/master/wp-
 admin/includes/ajax-actions.php

 contains the following code:

 {{{
 if ( $form = $wp_registered_widget_controls[ $widget_id ] ) {
 call_user_func_array( $form['callback'], $form['params'] );
 }
 }}}

 Is this if statement supposed to use an equality operator (two equals
 signs) instead of assigning a variable? If not, why is it assigning a
 variable in an if statement?

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


More information about the wp-trac mailing list