Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#10533 closed defect (bug) (fixed)

Php 5.3 deprecated errors

Reported by: mrmist's profile mrmist Owned by: westi's profile 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 16 years ago.
Remove deprecated and strict warnings from wp_debug
10533-deprecated-only.patch (1.2 KB) - added by nacin 15 years ago.
No E_DEPRECATED warnings when WP_DEBUG.

Download all attachments as: .zip

Change History (14)

#1 follow-up: @Denis-de-Bernardy
16 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.

#2 in reply to: ↑ 1 @mrmist
16 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.)

#3 @Denis-de-Bernardy
16 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.

@mrmist
16 years ago

Remove deprecated and strict warnings from wp_debug

#4 @mrmist
16 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.

#5 @mrmist
16 years ago

See also #10723

#6 follow-up: @dd32
15 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..

#7 @dd32
15 years ago

  • Keywords commit added; commi removed

#8 in reply to: ↑ 6 @westi
15 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 :-)

#9 @dd32
15 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);

#10 @nacin
15 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?

@nacin
15 years ago

No E_DEPRECATED warnings when WP_DEBUG.

#11 @nacin
15 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.

#12 @azaozz
15 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.