[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:50:38 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:
-------------------------------+------------------------------

Comment (by s1nc1tycyph3r):

 Replying to [comment:4 dd32]:
 > {{{
 > 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.
 ah i completely overlooked that! lol thx for pointing it out! it fixed
 most of the output errors
 however i am still getting The plugin generated 362 characters of
 unexpected output during activation. If you notice “headers already sent”
 messages, problems with syndication feeds or other issues, try
 deactivating or removing this plugin. message but i am not getting any
 further
 Warning:  Invalid argument supplied for foreach() in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 1987
 Warning:  Invalid argument supplied for foreach() in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 2020
 Warning:  Invalid argument supplied for foreach() in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 2050
 Warning:  Invalid argument supplied for foreach() in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 2593
 Warning:  Invalid argument supplied for foreach() in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 1824
 Warning:  array_keys() expects parameter 1 to be array, null given in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 1829
 Warning:  implode() [function.implode]: Invalid arguments passed in
 /home/tispgu/public_html/wp-testdomain/wp-includes/wp-db.php on line 1829
 message warnings!
 and yes i do use WP_DEBUG while developing new plugins!

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


More information about the wp-trac mailing list