Page MenuHomePhabricator

mw.Uri.clone() doesn't make a deep copy
Closed, ResolvedPublic

Description

mw.Uri.clone() copies each property individually, but it doesn't make a deep copy of the properties; almost all properties are simple types where it doesn't matter, but query is an object.

What's funny is that this breaks the example in the class documentation:

var a = new mw.Uri('http://localhost/w/index.php?foo=bar')
var b = a.clone()
a.extend({'baz':'quux'})
a.toString()

"http://localhost/w/index.php?foo=bar&baz=quux"

b.toString()

"http://localhost/w/index.php?foo=bar&baz=quux"


Version: unspecified
Severity: normal

Details

Reference
bz37708

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:21 AM
bzimport set Reference to bz37708.
bzimport added a subscriber: Unknown Object (MLST).

Using deep copy now for array and object properties being copied over.

https://gerrit.wikimedia.org/r/#/c/12614/

(In reply to comment #1)

Using deep copy now for array and object properties being copied over.

https://gerrit.wikimedia.org/r/#/c/12614/

Linking to a wrong changeset?

Indeed, he meant: I1c5644409c089e0a864292b8bd5a757ac31daa89