Page MenuHomePhabricator

PHP Deprecation: Assigning by reference ("=&") should be removed
Closed, ResolvedPublic

Description

There are lots of places in the code where variables are assigned using "=&" - a quick search shows that there may be around 100 such lines. As far as I know, this is deprecated in PHP 5.3, and now that 5.3.2+ is required, this seem like a good time to fix all of these assignments.


Version: 1.21.x
Severity: minor

Details

Reference
bz41671

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:04 AM
bzimport set Reference to bz41671.
bzimport added a subscriber: Unknown Object (MLST).

Exact warning (for search):

PHP Deprecated: Assigning the return value of new by reference is deprecated

Info: http://www.php.net/manual/en/oop4.newref.php

karun.84 wrote:

(In reply to comment #0)

There are lots of places in the code where variables are assigned using "=&"

a quick search shows that there may be around 100 such lines. As far as I
know,
this is deprecated in PHP 5.3, and now that 5.3.2+ is required, this seem
like
a good time to fix all of these assignments.

I don't see from the page anything about it saying =& is deprecated, on the info page for php5

Info: http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new

it still shows examples with =&, and neither the page in comment 1 or here, mentions anything about it.

I assume we're talking about "=& new " notation here?

karun.84 wrote:

(In reply to comment #3)

I assume we're talking about "=& new " notation here?

The original comment just says =& which is not deprecated, so I would assume not, unless the comment is missing this.

In fairness "=& new" doesn't appear in the MediaWiki codebase AFAICT, so if it is just that that is deprecated (as comment #1 suggests), we should probably close this as INVALID.

karun.84 wrote:

(In reply to comment #5)

In fairness "=& new" doesn't appear in the MediaWiki codebase AFAICT, so if
it
is just that that is deprecated (as comment #1 suggests), we should probably
close this as INVALID.

Yes agree. =& is not deprecated, and its unclear if the search results are from just searching for =& or =& new. A new bug should be opened for =& new if this is the problem.

(In reply to comment #1)

Exact warning (for search):

PHP Deprecated: Assigning the return value of new by reference is
deprecated

Info: http://www.php.net/manual/en/oop4.newref.php

Danny_B moved this task from Unsorted to PHP 5.3 on the [DO NOT USE] NewPHP board.Jul 11 2016, 2:21 AM