Make WordPress Core

Opened 16 years ago

Closed 14 years ago

Last modified 14 years ago

#16752 closed enhancement (wontfix)

Remove unnecessary return by reference

Reported by: scribu Owned by:
Priority: low Milestone:
Component: General Version:
Severity: normal Keywords: php5 has-patch needs-testing
Cc: Focuses:

Description

There are several functions in WP that return an object by reference.

With PHP5, this is not necessary anymore.

Examples of such functions: get_post(), get_term().

Attachments (3)

16752.patch (1.5 KB ) - added by hakre 15 years ago.
16752-2.diff (575 bytes ) - added by jkudish 15 years ago.
better return for get_term
16752-3.diff (1.1 KB ) - added by jkudish 15 years ago.
better returns for get_term and get_post

Download all attachments as: .zip

Change History (10)

#1 @hakre
15 years ago

I don't know how much the trade-off is for that, but the PHP manual states the following

Related: #16661, #16813, #16917

Version 0, edited 15 years ago by hakre (next)

@hakre
15 years ago

#2 @hakre
15 years ago

16752.patch as an example. This private function did return by reference, but the callee never received as reference. That's fixed.

The patch additionally shows that it's now possible to call object methods on function returns.

@jkudish
15 years ago

better return for get_term

@jkudish
15 years ago

better returns for get_term and get_post

#3 @jkudish
15 years ago

  • Cc joachim.kudish@… added
  • Keywords has-patch needs-testing added; needs-patch removed

#4 @scribu
15 years ago

  • Keywords 3.2-early removed

#5 @scribu
15 years ago

  • Priority normallow

#6 @scribu
14 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed

This has been shown to create back-compat problems.

#7 @jkudish
14 years ago

removed for get_post in [21597]

Note: See TracTickets for help on using tickets.