Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11589 closed feature request (wontfix)

Disable the availability of deprecated functions by default for new installs

Reported by: westi's profile westi Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Performance Keywords:
Focuses: Cc:

Description

We collect all the functions we don't want people to use into wp-includes/deprecated.php and make it easy for you to see if you are using them when WP_DEBUG is enabled.

I would like to take this one step further and not make them available at all for new installs.

My proposal introduces a new WP_ENABLE_DEPRECATED_FUNCTIONS define which defaults to false in wp-sample-config.php for new installs and true if not defined in wp-settings.php for old installs.

Attachments (1)

11589.diff (1.7 KB) - added by westi 15 years ago.
Implementation of this new feature.

Download all attachments as: .zip

Change History (18)

@westi
15 years ago

Implementation of this new feature.

#1 @westi
15 years ago

We should probably also use this define check in places where we call _deprecated_file and block the require_once();

#2 @Denis-de-Bernardy
15 years ago

+1 but only if we announce that this will happen far in advance. I take it that most plugin devs who use deprecated functions are not even aware that they're doing so.

or then, maybe we should split the deprecated.php file in two: recently deprecated, and completely deprecated; with the new define being required to include completely deprecated functions.

#3 @caesarsgrunt
15 years ago

+1 to what Denis-de-Bernady said.

Only disable functions which were deprecated at least two major releases ago.

So for example, if a function was deprecated in 2.8; disable it in 3.0. And perhaps remove it altogether in 3.2...

#4 @caesarsgrunt
15 years ago

And publicise well in advance.

#5 @scribu
15 years ago

Agree with caesarsgrunt: keep deprecated functions in deprecated.php for 2 or 3 major versions and then delete them completely.

Otherwise, you have to support the deprecated functions indefinetly, which gets progressively harder to do.

#6 @dd32
15 years ago

I'm agreeing that simply not including deprecated functions is bound to cause extra breakage that isnt required.

I agree with removing deprecated functions after a certain ammount of time, 2-3 releases depending on the exact nature of the function seems fair to me.. It gives those who are using it a chance to upgrade. Of course, it can make life hell for someone with a custom plugin, or a highly customised install from a dodgy developer.

#7 follow-up: @westi
15 years ago

For existing installs the functions are always going to be available.

This change would only affect new installs.

#8 in reply to: ↑ 7 ; follow-up: @filosofo
15 years ago

Replying to westi:

For existing installs the functions are always going to be available.

This change would only affect new installs.

I've read the ticket and looked at the patch, and I don't understand how the following wouldn't happen:

  • Joe newly installs WordPress with version 3.0. Hence WP_ENABLE_DEPRECATED_FUNCTIONS is true in Joe's wp-config.php file.
  • For 3.1, we deprecate function x.
  • Joe upgrades to 3.1. Bam! x is gone---not just deprecated---undefined, breaking his site with fatal errors from plugins calling x.

Instead, why not

  • Do a better job marking the version in which a function was deprecated (currently many just say "0.0").
  • At every major release, delete all functions deprecated 3 major versions ago.
  • Perhaps for functions one release away from being removed, throw an error in admin even if WP_DEBUG isn't set.

#9 @westi
15 years ago

Ok.. I get where you coming from now.

  • We are working on improving the version info and patches with the info in for missing functions are always welcome.
  • I don't think we can ever safely delete these functions as then you will break people who upgrade really old sites.
  • Maybe we should remove in from wp-sample-config.php and just introduce a way for people to take these functions out of scope if they don't need them.

#10 @scribu
15 years ago

If we do have to keep those functions around, I think it would be safer to make the constant always default to false.

Then we can let people know about it: Make a page in the Codex that lets you know that you should add the WP_ENABLE_DEPRECATED_FUNCTIONS to wp-config.php before upgrading an old site, etc.

#11 in reply to: ↑ 8 @nacin
15 years ago

Replying to filosofo:

  • Do a better job marking the version in which a function was deprecated (currently many just say "0.0").

Actually, I went through and researched these for every single deprecated function. Committed two days ago: [12526]

There are a few deprecated functions that need to be formally deprecated and moved to deprecated.php though -- #11388.

#12 follow-up: @strider72
15 years ago

This plugin might be of interest to people following this ticket. It tracks all calls to deprecated functions:

http://striderweb.com/nerdaphernalia/features/wp-log-deprecated-calls/

Now that the "when deprecated" data has been filled in (thanks nacin!) I should update it to make better use of that info.... ;-)

#13 in reply to: ↑ 12 @nacin
15 years ago

Replying to strider72:

Now that the "when deprecated" data has been filled in (thanks nacin!) I should update it to make better use of that info.... ;-)

Ah, no problem. There are actually a few that were missed due to some crossover, and were added in #11388, which could use some loving from a core dev. I imagine I will also get around to finding version numbers for numerous _deprecated_argument() calls I patched at '0.0'.

#14 @westi
15 years ago

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

After thinking this over a lot I don't think there is much benefit in adding this.

The comments above hi-light the fact that in a lot of cases we could break sites when we deprecate new functions.

Closing as WONTFIX.

#15 @caesarsgrunt
15 years ago

By leaving deprecated functions in core forever, wordpress will gradually become bloated. Much better to remove them a certain number of releases after they are deprecated. If due warning is given at the time of deprecation, in can hardly cause any problems. I can see no reason to carry on supporting deprecated functions for more than a year or two after they were deprecated.

#16 follow-up: @scribu
15 years ago

  • Component changed from General to Performance

We could set WP_ENABLE_DEPRECATED_FUNCTIONS to true by default so it wouldn't change current behaviour. People that don't need deprecated functions could then set it to false.

A different approach would be to move all the really old deprecated functions into a WP Legacy plugin. This is what BuddyPress does currently.

#17 in reply to: ↑ 16 @westi
15 years ago

Replying to scribu:

We could set WP_ENABLE_DEPRECATED_FUNCTIONS to true by default so it wouldn't change current behaviour. People that don't need deprecated functions could then set it to false.

A different approach would be to move all the really old deprecated functions into a WP Legacy plugin. This is what BuddyPress does currently.

The big problem is when you need the function you need it.

If it's on by default most people won't know to disable it, and we have conditional includes which object caches don't like.

Also how do you deal with the install/activation of plugin/theme which still uses the functions when they are disabled.

Note: See TracTickets for help on using tickets.