[wp-trac] [WordPress Trac] #21716: PHP 5.4 warning when updating plugins

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 29 02:45:31 UTC 2012


#21716: PHP 5.4 warning when updating plugins
--------------------------+-----------------------------
 Reporter:  knutsp        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.4.1
 Severity:  minor         |   Keywords:  needs-patch
--------------------------+-----------------------------
 When updating plugins from either /wp-admin/network/update-core.php
 (Multisite) or from /wp-admin/update-core.php (Single site) I get this
 error logged (many times), using PHP 5.4:
 {{{
 PHP Warning:  Creating default object from empty value in /mysite/wp-
 admin/includes/update.php on line 90
 }}}
 update-core.php:89 reads
 {{{
         if ( ! isset( $cur->current ) )
                 $cur->current = '';
 }}}
 I'm not sure what is the best approach to avoid this. Both the bad (?)
 {{{
                 @$cur->current = '';
 }}}
 and the better (?)
 {{{
         if ( ! is_object( $cur ) )
                 $cur = new stdClass;
         if ( ! isset( $cur->current ) )
                 $cur->current = '';
 }}}
 will avoid the warning, and seems to work.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21716>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list