Last modified: 2013-08-27 13:49:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54592, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52592 - mw.clone causes script error when used on a table returned from mw.loadData
mw.clone causes script error when used on a table returned from mw.loadData
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-07 01:06 UTC by CodeCat
Modified: 2013-08-27 13:49 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description CodeCat 2013-08-07 01:06:36 UTC
The function mw.clone is meant to create a deep copy of a value. mw.loadData returns read-only tables, so a deep copy is necessary to modify a table returned from mw.loadData. However, when an attempt is made to clone such a table, a script error occurs:

table from mw.loadData is read-only

This is obviously not the intended behaviour and it prevents one of the main uses of mw.clone.
Comment 1 Brad Jorsch 2013-08-07 13:43:42 UTC
(In reply to comment #0)
> This is obviously not the intended behaviour

Technically it is, sort of. mw.clone clones everything, including the metatable methods making the table read-only. That it does this before it tries to clone all the table members is what is making it fail, but it would fail anyway as soon as you tried to modify the cloned table.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links