page view (comes after parser cache, if used). Patch by ThomasV.
* Linker::formatComment corrupted the passed title object on PHP 5
if the comment included a section link. Use clone() to make a safe copy.
+* Add wfClone() wrapper since we're still using PHP 4 on some servers.
=== Caveats ===
if ( ! function_exists( 'ctype_alnum' ) )
require_once 'compatability/ctype.php';
+/**
+ * Wrapper for clone() for PHP 4, for the moment.
+ * PHP 5 won't let you declare a 'clone' function, even conditionally,
+ * so it has to be a wrapper with a different name.
+ */
+function wfClone( $object ) {
+ // WARNING: clone() is not a function in PHP 5, so function_exists fails.
+ if( version_compare( PHP_VERSION, '5.0' ) < 0 ) {
+ return $object;
+ } else {
+ return clone( $object );
+ }
+}
/**
* Where as we got a random seed
# This is hackish but should work in most cases.
$section = str_replace( '[[', '', $section );
$section = str_replace( ']]', '', $section );
- $sectionTitle = clone( $title );
+ $sectionTitle = wfClone( $title );
$sectionTitle->mFragment = $section;
$link = $this->makeKnownLinkObj( $sectionTitle, wfMsg( 'sectionlink' ) );
}