[wp-trac] [WordPress Trac] #47214: Adding new menu entries fails

WordPress Trac noreply at wordpress.org
Fri May 10 13:49:23 UTC 2019


#47214: Adding new menu entries fails
--------------------------+-----------------------------
 Reporter:  theincogtion  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  5.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I activated debug mode and tried to add an individual link to my top menu
 which resulted in:


 {{{
 [10-May-2019 10:17:15 UTC] PHP Warning: Invalid argument supplied for
 foreach() in /mnt/web318/b1/45/58782945/htdocs/WordPress_SecureMode_01/wp-
 includes/wp-db.php on line 2363
 }}}

 (nothing is added to the menu)

 The content of wp-db.php at line 2363

 {{{#!php
 <?php
 foreach ( $data as $field => $value ) {
 }}}
 context:

 {{{#!php
 <?php
 /**
          * Prepares arrays of value/format pairs as passed to wpdb CRUD
 methods.
          *
          * @since 4.2.0
          *
          * @param array $data   Array of fields to values.
          * @param mixed $format Formats to be mapped to the values in
 $data.
          * @return array Array, keyed by field names with values being an
 array
          *               of 'value' and 'format' keys.
          */
         protected function process_field_formats( $data, $format ) {
                 $formats = $original_formats = (array) $format;

                 foreach ( $data as $field => $value ) {
                         $value = array(
                                 'value'  => $value,
                                 'format' => '%s',
                         );

                         if ( ! empty( $format ) ) {
                                 $value['format'] = array_shift( $formats
 );
                                 if ( ! $value['format'] ) {
                                         $value['format'] = reset(
 $original_formats );
                                 }
                         } elseif ( isset( $this->field_types[ $field ] ) )
 {
                                 $value['format'] = $this->field_types[
 $field ];
                         }

                         $data[ $field ] = $value;
                 }

                 return $data;
         }
 }}}


 Health summary:
 https://pastebin.com/JWptWjkk

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


More information about the wp-trac mailing list