[wp-trac] [WordPress Trac] #32640: wp-db.php bug when activating plugin ("unexpected output" During Plugin Activation)

WordPress Trac noreply at wordpress.org
Sun Jun 14 05:38:08 UTC 2015


#32640: wp-db.php bug when activating plugin ("unexpected output" During Plugin
Activation)
-------------------------------+------------------------------
 Reporter:  s1nc1tycyph3r      |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Database           |     Version:  4.2.2
 Severity:  normal             |  Resolution:
 Keywords:  2nd-opinion close  |     Focuses:
-------------------------------+------------------------------
Changes (by dd32):

 * keywords:   => 2nd-opinion close


Comment:

 {{{
 for($i=0; $i<=sizeof($testdata); $i++)
 {
         $wpdb->insert(
                 $minimalplugin_data_tablename,
 $testdata[$i]
         );
 }}}

 `sizeof` returns the count of the array, in this case 3, however the
 indices are only 0, 1, and 2. So you're passing invalid data through
 (`null`) - use `<` rather than `<=`.

 If you're not already developing with
 [https://codex.wordpress.org/Debugging_in_WordPress WP_DEBUG] enabled,I'd
 highly suggest you do.

 IMHO, passing invalid data here isn't a case we should protect against.

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


More information about the wp-trac mailing list