WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#10533 closed defect (bug) (fixed)

Php 5.3 deprecated errors

Reported by: mrmist Owned by: westi
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Warnings/Notices Keywords: has-patch commit tested
Focuses: Cc:

Description

There was a ticket #8701 that was meant to look at this, and it was marked as fixed 3 months ago. Yet today if I load up trunk in PHP5.3 with wp_debug on I get

PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\cache.php on line 103 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\pomo\mo.php on line 171 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\l10n.php on line 407 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\query.php on line 61 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\theme.php on line 1133 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\taxonomy.php on line 617 PHP Deprecated: Assigning the return value of new by reference is deprecated in E:\webpage\svn\trunk\wp-includes\widgets.php on line 320

Many of which I guess relate to the use of $foo = & new bah.

But anyway, I look back through that ticket and I see that & ~ E_DEPRECATED was played with a few times, but the final commit never bothered with it. Should we not have an & ~ E_DEPRECATED in there somewhere? Otherwise I can't see a way around the error reports.

(I didn't re-open the last ticket as it is old and long.)

Hoping this is one of the first things to change once PHP4 support goes.

Attachments (2)

settings.patch (756 bytes) - added by mrmist 6 years ago.
Remove deprecated and strict warnings from wp_debug
10533-deprecated-only.patch (1.2 KB) - added by nacin 5 years ago.
No E_DEPRECATED warnings when WP_DEBUG.

Download all attachments as: .zip

Change History (14)

comment:1 follow-up: @Denis-de-Bernardy6 years ago

Mm... WP_DEBUG would use E_ALL. Maybe it should be using E_ALL & ~ E_DEPRECATED & ~ E_STRICT though, depending on if those defines are around.

D.

comment:2 in reply to: ↑ 1 @mrmist6 years ago

Replying to Denis-de-Bernardy:

Mm... WP_DEBUG would use E_ALL. Maybe it should be using E_ALL & ~ E_DEPRECATED & ~ E_STRICT though, depending on if those defines are around.

It would be helpful, because otherwise it is currently impossible to test on IIS & PHP5.3 with wp_debug, because you're halted by deprecation warnings. (Which will of course be around until core moves onwards.)

comment:3 @Denis-de-Bernardy6 years ago

yeah... can you write the patch? it shouldn't be too hard, if you base it on what things look like after r11128.

@mrmist6 years ago

Remove deprecated and strict warnings from wp_debug

comment:4 @mrmist6 years ago

  • Keywords has-patch added; needs-patch removed

Attached a stab at it that works for me against PHP5.3. Removes deprecated warnings but still allows other issues through.

comment:5 @mrmist6 years ago

See also #10723

comment:6 follow-up: @dd326 years ago

  • Keywords dev-feedback commi added

Can we please get this fixed(Well.. Deprecated warnings hidden)?

I have to hack it in every SVN checkout i make, because its impossible to override it otherwise..

comment:7 @dd326 years ago

  • Keywords commit added; commi removed

comment:8 in reply to: ↑ 6 @westi6 years ago

  • Owner set to westi
  • Status changed from new to accepted

Replying to dd32:

Can we please get this fixed(Well.. Deprecated warnings hidden)?

I have to hack it in every SVN checkout i make, because its impossible to override it otherwise..

I'll look at this.

After the joys I had with this before I'm going to get 5.3 installed somewhere first though :-)

comment:9 @dd326 years ago

After the joys I had with this before I'm going to get 5.3 installed somewhere first though :-)

Luckily it installs nearly anywhere just as easily as PHP 5.2 did now :)

For the record, All i've been doing is modifying it to this: (on PHP 5.3), I've not once seen anything related to E_STRICT yet.

error_reporting(E_ALL & ~E_DEPRECATED);

comment:10 @nacin5 years ago

  • Keywords dev-feedback removed

Patch attached - hybrid of what's been posted. If WP_DEBUG, check if E_DEPRECATED is defined and exclude it if it is. E_STRICT is not part of E_ALL in PHP < 6.

I think we're good to commit this?

@nacin5 years ago

No E_DEPRECATED warnings when WP_DEBUG.

comment:11 @nacin5 years ago

  • Keywords tested added

Been applying this patch to wp-settings.php after svn checkouts for weeks, otherwise WP is unusable in PHP > 5.3 with WP_DEBUG.

comment:12 @azaozz5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [12384]) Do not show PHP 5.3 deprecated errors when WP_DEBUG is set, props mrmist nacin, fixes #10533

Note: See TracTickets for help on using tickets.