https://bugzilla.wikimedia.org/show_bug.cgi?id=20036
Summary: php error in LinkHolderArray
Product: MediaWiki
Version: 1.15.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Normal
Component: Page rendering
AssignedTo: [email protected]
ReportedBy: [email protected]
if an extension tries to clone the MW parser, MW wants to merge
LinkHolderArrays.
This leads to a php error because the cloning command (something like
"$myParser = clone $parser;") oviously does not call the constructor of the
LinkHolderArray. The reason is probably that the LinkHolderArray in general is
only constructed on demand.
The following bugfix works, but maybe a better solution can be found:
<pre>
/**
* Merge another LinkHolderArray into this one
*/
function merge( $other ) {
// add this!!
// protect against uninitialized instance (which can happen if
parser is 'cloned')
if (!isset($this->interwikis)) {
$this->internals = array();
$this->interwikis = array();
$this->size = 0;
$this->parent = $other->parent;
}
// end !!
foreach ( $other->internals as $ns => $entries ) {
$this->size += count( $entries );
if ( !isset( $this->internals[$ns] ) ) {
$this->internals[$ns] = $entries;
} else {
$this->internals[$ns] += $entries;
}
}
$this->interwikis += $other->interwikis;
}
</pre>
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l