* (bug 2885) Fix fatal errors and notices in PHP 5.1.0beta3
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 22 Jul 2005 11:29:15 +0000 (11:29 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 22 Jul 2005 11:29:15 +0000 (11:29 +0000)
* (bug 2931) Fix additional notices on reference use in PHP 4.4.0

13 files changed:
RELEASE-NOTES
includes/Article.php
includes/BagOStuff.php
includes/Database.php
includes/DatabaseFunctions.php
includes/DifferenceEngine.php
includes/Linker.php
includes/Namespace.php
includes/ObjectCache.php
includes/Parser.php
includes/Revision.php
includes/SearchUpdate.php
includes/SkinTemplate.php

index 7c1903a..8e1a46d 100644 (file)
@@ -587,6 +587,10 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * Specify USE INDEX on Allpages chunk queries, sometimes gets lost
   due to bogus optimization
 * (bug 275) Section duplication fix
+* Remove unused use of undefined variable in UserMailer
+* Fix notice on search index update due to non-array
+* (bug 2885) Fix fatal errors and notices in PHP 5.1.0beta3
+* (bug 2931) Fix additional notices on reference use in PHP 4.4.0
 
 
 === Caveats ===
index 9a26a2e..3c1c3eb 100644 (file)
@@ -487,10 +487,11 @@ class Article {
         */
        function &getDB() {
                #if ( $this->mForUpdate ) {
-                       return wfGetDB( DB_MASTER );
+                       $ret =& wfGetDB( DB_MASTER );
                #} else {
-               #       return wfGetDB( DB_SLAVE );
+               #       $ret =& wfGetDB( DB_SLAVE );
                #}
+               return $ret;
        }
 
        /**
index 78ca511..9ac3064 100644 (file)
@@ -359,7 +359,7 @@ class SqlBagOStuff extends BagOStuff {
         * @param string $serial
         * @return mixed
         */
-       function &_unserialize( $serial ) {
+       function _unserialize( $serial ) {
                if( function_exists( 'gzinflate' ) ) {
                        $decomp = @gzinflate( $serial );
                        if( false !== $decomp ) {
index 16f277e..69a3072 100644 (file)
@@ -937,6 +937,9 @@ class Database {
         * @return string
         */
        function makeUpdateOptions( $options ) {
+               if( !is_array( $options ) ) {
+                       wfDebugDieBacktrace( 'makeUpdateOptions given non-array' );
+               }
                $opts = array();
                if ( in_array( 'LOW_PRIORITY', $options ) )
                        $opts[] = $this->lowPriorityOption();
@@ -1453,7 +1456,7 @@ class Database {
        /**
         * @todo document
         */
-       function &resultObject( &$result ) {
+       function resultObject( &$result ) {
                if( empty( $result ) ) {
                        return NULL;
                } else {
@@ -1565,7 +1568,7 @@ class ResultWrapper {
        /**
         * @todo document
         */
-       function &fetchObject() {
+       function fetchObject() {
                return $this->db->fetchObject( $this->result );
        }
        
index 772ca43..3705969 100644 (file)
@@ -49,7 +49,8 @@ function wfSingleQuery( $sql, $dbi, $fname = '' ) {
  */
 function &wfGetDB( $db = DB_LAST, $groups = array() ) {
        global $wgLoadBalancer;
-       return $wgLoadBalancer->getConnection( $db, true, $groups );
+       $ret =& $wgLoadBalancer->getConnection( $db, true, $groups );
+       return $ret;
 }
        
 /**
index 24d0767..e78fb87 100644 (file)
@@ -309,9 +309,9 @@ CONTROL;
 
                $dbr =& wfGetDB( DB_SLAVE );
                if( $this->mNewid ) {
-                       $this->newRev =& Revision::newFromId( $this->mNewid );
+                       $this->newRev = Revision::newFromId( $this->mNewid );
                } else {
-                       $this->newRev =& Revision::newFromTitle( $wgTitle );
+                       $this->newRev = Revision::newFromTitle( $wgTitle );
                }
                if( is_null( $this->newRev ) ) {
                        return false;
@@ -332,9 +332,9 @@ CONTROL;
                }
                
                if( $this->mOldid ) {
-                       $this->oldRev =& Revision::newFromId( $this->mOldid );
+                       $this->oldRev = Revision::newFromId( $this->mOldid );
                } else {
-                       $this->oldRev =& $this->newRev->getPrevious();
+                       $this->oldRev = $this->newRev->getPrevious();
                        $this->mOldid = $this->oldRev->getId();
                }
                if( is_null( $this->oldRev ) ) {
index 76ddde2..6da46fd 100644 (file)
@@ -130,7 +130,7 @@ class Linker {
        /**
         * Pass a title object, not a title string
         */
-       function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
+       function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
                global $wgOut, $wgUser;
                $fname = 'Linker::makeLinkObj';
                wfProfileIn( $fname );
@@ -368,7 +368,7 @@ class Linker {
        }
 
        /** @todo document */
-       function makeImageLinkObj( &$nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false, 
+       function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false, 
          $thumb = false, $manual_thumb = '' ) 
        {
                global $wgContLang, $wgUser, $wgThumbLimits;
@@ -546,7 +546,7 @@ class Linker {
        /**
         * Pass a title object, not a title string
         */
-       function makeBrokenImageLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+       function makeBrokenImageLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
                # Fail gracefully
                if ( ! isset($nt) ) {
                        # wfDebugDieBacktrace();
index a7345eb..d1d06ac 100644 (file)
@@ -100,7 +100,7 @@ class Namespace {
        /**
         * Returns the canonical (English Wikipedia) name for a given index
         */
-       function &getCanonicalName( $index ) {
+       function getCanonicalName( $index ) {
                global $wgCanonicalNamespaceNames;
                return $wgCanonicalNamespaceNames[$index];
        }
@@ -109,7 +109,7 @@ class Namespace {
         * Returns the index for a given canonical name, or NULL
         * The input *must* be converted to lower case first
         */
-       function &getCanonicalIndex( $name ) {
+       function getCanonicalIndex( $name ) {
                global $wgCanonicalNamespaceNames;
                static $xNamespaces = false;
                if ( $xNamespaces === false ) {
index 5acf923..dbf6221 100644 (file)
@@ -107,17 +107,20 @@ function &wfGetCache( $inputType ) {
 
 function &wfGetMainCache() {
        global $wgMainCacheType;
-       return wfGetCache( $wgMainCacheType );
+       $ret =& wfGetCache( $wgMainCacheType );
+       return $ret;
 }
 
 function &wfGetMessageCacheStorage() {
        global $wgMessageCacheType;
-       return wfGetCache( $wgMessageCacheType );
+       $ret =& wfGetCache( $wgMessageCacheType );
+       return $ret;
 }
 
-function wfGetParserCacheStorage() {
+function &wfGetParserCacheStorage() {
        global $wgParserCacheType;
-       return wfGetCache( $wgParserCacheType );
+       $ret =& wfGetCache( $wgParserCacheType );
+       return $ret;
 }
 
 ?>
index c60a76b..d851eb4 100644 (file)
@@ -3373,7 +3373,7 @@ class ParserOptions
        function getUseDynamicDates()               { return $this->mUseDynamicDates; }
        function getInterwikiMagic()                { return $this->mInterwikiMagic; }
        function getAllowExternalImages()           { return $this->mAllowExternalImages; }
-       function getSkin()                          { return $this->mSkin; }
+       function &getSkin()                         { return $this->mSkin; }
        function getDateFormat()                    { return $this->mDateFormat; }
        function getEditSection()                   { return $this->mEditSection; }
        function getNumberHeadings()                { return $this->mNumberHeadings; }
index 1905a26..e7e9b3b 100644 (file)
@@ -21,7 +21,7 @@ class Revision {
         * @static
         * @access public
         */
-       function &newFromId( $id ) {
+       function newFromId( $id ) {
                return Revision::newFromConds(
                        array( 'page_id=rev_page',
                               'rev_id' => IntVal( $id ) ) );
@@ -38,7 +38,7 @@ class Revision {
         * @access public
         * @static
         */
-       function &newFromTitle( &$title, $id = 0 ) {
+       function newFromTitle( &$title, $id = 0 ) {
                if( $id ) {
                        $matchId = IntVal( $id );
                } else {
@@ -62,7 +62,7 @@ class Revision {
         * @return Revision
         * @access public
         */
-       function &loadFromPageId( &$db, $pageid, $id = 0 ) {
+       function loadFromPageId( &$db, $pageid, $id = 0 ) {
                if( $id ) {
                        $matchId = IntVal( $id );
                } else {
@@ -86,7 +86,7 @@ class Revision {
         * @return Revision
         * @access public
         */
-       function &loadFromTitle( &$db, $title, $id = 0 ) {
+       function loadFromTitle( &$db, $title, $id = 0 ) {
                if( $id ) {
                        $matchId = IntVal( $id );
                } else {
@@ -112,7 +112,7 @@ class Revision {
         * @access public
         * @static
         */
-       function &loadFromTimestamp( &$db, &$title, $timestamp ) {
+       function loadFromTimestamp( &$db, &$title, $timestamp ) {
                return Revision::loadFromConds(
                        $db,
                        array( 'rev_timestamp'  => $db->timestamp( $timestamp ),
@@ -129,7 +129,7 @@ class Revision {
         * @static
         * @access private
         */
-       function &newFromConds( $conditions ) {
+       function newFromConds( $conditions ) {
                $db =& wfGetDB( DB_SLAVE );
                $row = Revision::loadFromConds( $db, $conditions );
                if( is_null( $row ) ) {
@@ -149,8 +149,8 @@ class Revision {
         * @static
         * @access private
         */
-       function &loadFromConds( &$db, $conditions ) {
-               $res =& Revision::fetchFromConds( $db, $conditions );
+       function loadFromConds( &$db, $conditions ) {
+               $res = Revision::fetchFromConds( $db, $conditions );
                if( $res ) {
                        $row = $res->fetchObject();
                        $res->free();
@@ -171,7 +171,7 @@ class Revision {
         * @static
         * @access public
         */
-       function &fetchAllRevisions( &$title ) {
+       function fetchAllRevisions( &$title ) {
                return Revision::fetchFromConds(
                        wfGetDB( DB_SLAVE ),
                        array( 'page_namespace' => $title->getNamespace(),
@@ -189,7 +189,7 @@ class Revision {
         * @static
         * @access public
         */
-       function &fetchRevision( &$title ) {
+       function fetchRevision( &$title ) {
                return Revision::fetchFromConds(
                        wfGetDB( DB_SLAVE ),
                        array( 'rev_id=page_latest',
@@ -209,7 +209,7 @@ class Revision {
         * @static
         * @access private
         */
-       function &fetchFromConds( &$db, $conditions ) {
+       function fetchFromConds( &$db, $conditions ) {
                $res = $db->select(
                        array( 'page', 'revision' ),
                        array( 'page_namespace',
@@ -301,7 +301,7 @@ class Revision {
         * Returns the title of the page associated with this entry.
         * @return Title
         */
-       function &getTitle() {
+       function getTitle() {
                if( isset( $this->mTitle ) ) {
                        return $this->mTitle;
                }
@@ -313,7 +313,7 @@ class Revision {
                               'rev_id' => $this->mId ),
                        'Revision::getTItle' );
                if( $row ) {
-                       $this->mTitle =& Title::makeTitle( $row->page_namespace,
+                       $this->mTitle = Title::makeTitle( $row->page_namespace,
                                                           $row->page_title );
                }
                return $this->mTitle;
@@ -389,7 +389,7 @@ class Revision {
        /**
         * @return Revision
         */
-       function &getPrevious() {
+       function getPrevious() {
                $prev = $this->mTitle->getPreviousRevisionID( $this->mId );
                return Revision::newFromTitle( $this->mTitle, $prev );
        }
@@ -397,7 +397,7 @@ class Revision {
        /**
         * @return Revision
         */
-       function &getNext() {
+       function getNext() {
                $next = $this->mTitle->getNextRevisionID( $this->mId );
                return Revision::newFromTitle( $this->mTitle, $next );
        }
@@ -601,7 +601,7 @@ class Revision {
         * @param bool     $minor
         * @return Revision
         */
-       function &newNullRevision( &$dbw, $pageId, $summary, $minor ) {
+       function newNullRevision( &$dbw, $pageId, $summary, $minor ) {
                $fname = 'Revision::newNullRevision';
                wfProfileIn( $fname );
                
index dc383fe..d64d53d 100644 (file)
@@ -38,7 +38,7 @@ class SearchUpdate {
                wfProfileIn( $fname );
 
                require_once( 'SearchEngine.php' );
-               $search =& SearchEngine::create();
+               $search = SearchEngine::create();
                $lc = $search->legalSearchChars() . '&#;';
                
                if( $this->mText === false ) {
index 20f017d..9ffb74d 100644 (file)
@@ -132,7 +132,7 @@ class SkinTemplate extends Skin {
         * @return object
         * @access private
         */
-       function &setupTemplate( $classname, $repository=false, $cache_dir=false ) {
+       function setupTemplate( $classname, $repository=false, $cache_dir=false ) {
                return new $classname();
        }
 
@@ -161,7 +161,7 @@ class SkinTemplate extends Skin {
                $this->mTitle =& $wgTitle;
                $this->mUser =& $wgUser;
 
-               $tpl =& $this->setupTemplate( $this->template, 'skins' );
+               $tpl = $this->setupTemplate( $this->template, 'skins' );
 
                #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
                $tpl->setTranslator(new MediaWiki_I18N());
@@ -483,7 +483,7 @@ class SkinTemplate extends Skin {
        }
 
 
-       function tabAction( &$title, $message, $selected, $query='', $checkEdit=false ) {
+       function tabAction( $title, $message, $selected, $query='', $checkEdit=false ) {
                $classes = array();
                if( $selected ) {
                        $classes[] = 'selected';