Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#11028 closed defect (bug) (fixed)

Remove get_the_content / wp_link_pages dead code

Reported by: filosofo's profile filosofo Owned by: ryan's profile ryan
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Template Keywords: $more_file $file
Focuses: Cc:

Description

$file and $more_file are variables that appear in wp_link_pages() and get_the_content() and are not used.

In the oldest version of WordPress I can find, 1.2.1, they don't seem to do anything either. Can someone enlighten me about their original purpose?

Patch removes the dead code.

Attachments (1)

get_the_content-dead_code.11028.diff (2.6 KB) - added by filosofo 14 years ago.

Download all attachments as: .zip

Change History (10)

#1 @azaozz
14 years ago

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

(In [12105]) Remove unused vars in get_the_content and wp_link_pages, props filosofo, fixes #11028

#2 follow-up: @westi
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Should we not keep the last argument but mark it as deprecated in case anyone was calling the function with that argument set?

#3 in reply to: ↑ 2 ; follow-up: @filosofo
14 years ago

Replying to westi:

Should we not keep the last argument but mark it as deprecated in case anyone was calling the function with that argument set?

No, because calling it with that argument doesn't do anything. What difference does it make if they call it or not?

#4 in reply to: ↑ 3 ; follow-ups: @westi
14 years ago

Replying to filosofo:

Replying to westi:

Should we not keep the last argument but mark it as deprecated in case anyone was calling the function with that argument set?

No, because calling it with that argument doesn't do anything. What difference does it make if they call it or not?

Do you not get an error about incorrect number of arguments - if not why are we keeping other deprecated args on functions.

#5 in reply to: ↑ 4 @filosofo
14 years ago

You can pass more arguments to a function than are explicitly defined, but you can't neglect to pass a value to an argument that's defined without a default value--that's what will produce an error.

Replying to westi:

why are we keeping other deprecated args on functions.

I don't know. This one kinda makes sense, because $autoload isn't deprecated, so removing the deprecated one would change the argument order:

function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {

I can see the point of this one, too, as it is still functional and gives the developer warning that in...er...2.7 it's going to be non-functional:

 *
 * @param string $domain Unique identifier for retrieving translated strings
 * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder,
 *      where the .mo file resides. Deprecated, but still functional until 2.7
 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path
 */
function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {

But we could probably get rid of this one, especially since the removed argument was unlikely to have been used outside of core.

function wp_get_http( $url, $file_path = false, $deprecated = false ) {

Grepping through core I'm amazed at how much "deprecated" cruft there is. I think I'll make another patch to clear out some of this stuff.

#6 in reply to: ↑ 4 @azaozz
14 years ago

Replying to westi:

Do you not get an error about incorrect number of arguments...

Not on user defined functions only on built-in. That's the basis for func_get_args() and similar.

#7 @nacin
14 years ago

  • Keywords close added; has-patch $more_file $file removed

Thinking this can be closed as fixed assuming there's another patch for 3.0 to clear out deprecated arguments when they don't affect the argument order.

#8 @filosofo
14 years ago

  • Keywords $more_file $file added; close removed
  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.