WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#12709 closed defect (bug) (duplicate)

PHP 5.3 : Assigning the return value of new by reference is deprecated

Reported by: devil1591 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Warnings/Notices Keywords:
Focuses: Cc:

Description

when upgrading PHP to PHP 5.3, you have errors of this type.
set_magic_quotes_runtime( 0 ); is also deprecated

Attachments (4)

simplepie-#12709.diff (46.0 KB) - added by j_schumann 3 years ago.
fix new by reference in class-simplepie.php
phpmailer-#12709.diff (861 bytes) - added by j_schumann 3 years ago.
replace set_magic_quotes_runtime in class-phpmailer.php
pclzip-#12709.diff (1.5 KB) - added by j_schumann 3 years ago.
replace set_magic_quotes_runtime in class-pclzip.php, remove check for deprecated functions
diff-#12709.diff (6.4 KB) - added by j_schumann 3 years ago.
fix new by reference in Text/Diff

Download all attachments as: .zip

Change History (12)

comment:1 @nacin5 years ago

  • Milestone 3.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

E_DEPRECATED errors are suppressed in WordPress, so you should never see these.

We need to keep the code that is deprecated in 5.3 to be compatible with PHP 4.

comment:2 @scribu5 years ago

Also see #10533

comment:3 @devil15915 years ago

These errors happen because some plugins call directly wp-config.php instead of calling wp-load.php

comment:4 @j_schumann3 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Since WP 3.2 PHP4 support is retired and PHP5.2+ required so it would be a good time now with 3.3 coming to fix those errors.
Changing the error_reporting value or deactivating Plugins are only cosmetic solutions, the code still is deprecated.

There are some core files throwing E_DEPRECATED, mostly from "Assigning the return value of new by reference", other occurences of deprecated code like the aforementioned set_magic_quotes_runtime() have already been fixed in trunk.

Some of the files holding deprecated code include:
/wp-includes/widgets.php:324
/wp-includes/class-wp.php:570
/wp-includes/taxonomy.php:1161
/wp-includes/theme.php:1721
/wp-includes/l10n.php:486
/wp-includes/query.php:92
/wp-includes/class-phpmailer.php - some occurences
/wp-includes/class-simplepie.php - many occurences

Most of these can be fixed by simply removing the ampersand in front of the new operator or function definiton which does not change the functionality for PHP5+

comment:5 @scribu3 years ago

  • Keywords needs-patch added
  • Milestone set to Future Release

@j_schumann3 years ago

fix new by reference in class-simplepie.php

@j_schumann3 years ago

replace set_magic_quotes_runtime in class-phpmailer.php

@j_schumann3 years ago

replace set_magic_quotes_runtime in class-pclzip.php, remove check for deprecated functions

@j_schumann3 years ago

fix new by reference in Text/Diff

comment:6 @j_schumann3 years ago

  • Cc j_schumann added
  • Keywords needs-patch removed

All other occurences of "set_magic_quotes_runtime", "&new" and "& new" seem to be fixed in trunk already.

comment:7 @scribu3 years ago

  • Keywords needs-patch 2nd-opinion added

Those are third-party libraries. We should try to update them to newer versions, instead of patching them directly.

comment:8 @SergeyBiryukov3 years ago

  • Component changed from General to Warnings/Notices
  • Keywords needs-patch 2nd-opinion removed
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.