r10239 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10238‎ | r10239 | r10240 >
Date:11:29, 22 July 2005
Author:vibber
Status:old
Tags:
Comment:
* (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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/BagOStuff.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DatabaseFunctions.php (modified) (history)
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Namespace.php (modified) (history)
  • /trunk/phase3/includes/ObjectCache.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SearchUpdate.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/BagOStuff.php
@@ -359,7 +359,7 @@
360360 * @param string $serial
361361 * @return mixed
362362 */
363 - function &_unserialize( $serial ) {
 363+ function _unserialize( $serial ) {
364364 if( function_exists( 'gzinflate' ) ) {
365365 $decomp = @gzinflate( $serial );
366366 if( false !== $decomp ) {
Index: trunk/phase3/includes/Article.php
@@ -487,10 +487,11 @@
488488 */
489489 function &getDB() {
490490 #if ( $this->mForUpdate ) {
491 - return wfGetDB( DB_MASTER );
 491+ $ret =& wfGetDB( DB_MASTER );
492492 #} else {
493 - # return wfGetDB( DB_SLAVE );
 493+ # $ret =& wfGetDB( DB_SLAVE );
494494 #}
 495+ return $ret;
495496 }
496497
497498 /**
Index: trunk/phase3/includes/ObjectCache.php
@@ -107,17 +107,20 @@
108108
109109 function &wfGetMainCache() {
110110 global $wgMainCacheType;
111 - return wfGetCache( $wgMainCacheType );
 111+ $ret =& wfGetCache( $wgMainCacheType );
 112+ return $ret;
112113 }
113114
114115 function &wfGetMessageCacheStorage() {
115116 global $wgMessageCacheType;
116 - return wfGetCache( $wgMessageCacheType );
 117+ $ret =& wfGetCache( $wgMessageCacheType );
 118+ return $ret;
117119 }
118120
119 -function wfGetParserCacheStorage() {
 121+function &wfGetParserCacheStorage() {
120122 global $wgParserCacheType;
121 - return wfGetCache( $wgParserCacheType );
 123+ $ret =& wfGetCache( $wgParserCacheType );
 124+ return $ret;
122125 }
123126
124127 ?>
Index: trunk/phase3/includes/Linker.php
@@ -130,7 +130,7 @@
131131 /**
132132 * Pass a title object, not a title string
133133 */
134 - function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
 134+ function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
135135 global $wgOut, $wgUser;
136136 $fname = 'Linker::makeLinkObj';
137137 wfProfileIn( $fname );
@@ -368,7 +368,7 @@
369369 }
370370
371371 /** @todo document */
372 - function makeImageLinkObj( &$nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
 372+ function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
373373 $thumb = false, $manual_thumb = '' )
374374 {
375375 global $wgContLang, $wgUser, $wgThumbLimits;
@@ -546,7 +546,7 @@
547547 /**
548548 * Pass a title object, not a title string
549549 */
550 - function makeBrokenImageLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
 550+ function makeBrokenImageLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
551551 # Fail gracefully
552552 if ( ! isset($nt) ) {
553553 # wfDebugDieBacktrace();
Index: trunk/phase3/includes/Parser.php
@@ -3373,7 +3373,7 @@
33743374 function getUseDynamicDates() { return $this->mUseDynamicDates; }
33753375 function getInterwikiMagic() { return $this->mInterwikiMagic; }
33763376 function getAllowExternalImages() { return $this->mAllowExternalImages; }
3377 - function getSkin() { return $this->mSkin; }
 3377+ function &getSkin() { return $this->mSkin; }
33783378 function getDateFormat() { return $this->mDateFormat; }
33793379 function getEditSection() { return $this->mEditSection; }
33803380 function getNumberHeadings() { return $this->mNumberHeadings; }
Index: trunk/phase3/includes/DatabaseFunctions.php
@@ -49,7 +49,8 @@
5050 */
5151 function &wfGetDB( $db = DB_LAST, $groups = array() ) {
5252 global $wgLoadBalancer;
53 - return $wgLoadBalancer->getConnection( $db, true, $groups );
 53+ $ret =& $wgLoadBalancer->getConnection( $db, true, $groups );
 54+ return $ret;
5455 }
5556
5657 /**
Index: trunk/phase3/includes/SearchUpdate.php
@@ -38,7 +38,7 @@
3939 wfProfileIn( $fname );
4040
4141 require_once( 'SearchEngine.php' );
42 - $search =& SearchEngine::create();
 42+ $search = SearchEngine::create();
4343 $lc = $search->legalSearchChars() . '&#;';
4444
4545 if( $this->mText === false ) {
Index: trunk/phase3/includes/Revision.php
@@ -21,7 +21,7 @@
2222 * @static
2323 * @access public
2424 */
25 - function &newFromId( $id ) {
 25+ function newFromId( $id ) {
2626 return Revision::newFromConds(
2727 array( 'page_id=rev_page',
2828 'rev_id' => IntVal( $id ) ) );
@@ -38,7 +38,7 @@
3939 * @access public
4040 * @static
4141 */
42 - function &newFromTitle( &$title, $id = 0 ) {
 42+ function newFromTitle( &$title, $id = 0 ) {
4343 if( $id ) {
4444 $matchId = IntVal( $id );
4545 } else {
@@ -62,7 +62,7 @@
6363 * @return Revision
6464 * @access public
6565 */
66 - function &loadFromPageId( &$db, $pageid, $id = 0 ) {
 66+ function loadFromPageId( &$db, $pageid, $id = 0 ) {
6767 if( $id ) {
6868 $matchId = IntVal( $id );
6969 } else {
@@ -86,7 +86,7 @@
8787 * @return Revision
8888 * @access public
8989 */
90 - function &loadFromTitle( &$db, $title, $id = 0 ) {
 90+ function loadFromTitle( &$db, $title, $id = 0 ) {
9191 if( $id ) {
9292 $matchId = IntVal( $id );
9393 } else {
@@ -112,7 +112,7 @@
113113 * @access public
114114 * @static
115115 */
116 - function &loadFromTimestamp( &$db, &$title, $timestamp ) {
 116+ function loadFromTimestamp( &$db, &$title, $timestamp ) {
117117 return Revision::loadFromConds(
118118 $db,
119119 array( 'rev_timestamp' => $db->timestamp( $timestamp ),
@@ -129,7 +129,7 @@
130130 * @static
131131 * @access private
132132 */
133 - function &newFromConds( $conditions ) {
 133+ function newFromConds( $conditions ) {
134134 $db =& wfGetDB( DB_SLAVE );
135135 $row = Revision::loadFromConds( $db, $conditions );
136136 if( is_null( $row ) ) {
@@ -149,8 +149,8 @@
150150 * @static
151151 * @access private
152152 */
153 - function &loadFromConds( &$db, $conditions ) {
154 - $res =& Revision::fetchFromConds( $db, $conditions );
 153+ function loadFromConds( &$db, $conditions ) {
 154+ $res = Revision::fetchFromConds( $db, $conditions );
155155 if( $res ) {
156156 $row = $res->fetchObject();
157157 $res->free();
@@ -171,7 +171,7 @@
172172 * @static
173173 * @access public
174174 */
175 - function &fetchAllRevisions( &$title ) {
 175+ function fetchAllRevisions( &$title ) {
176176 return Revision::fetchFromConds(
177177 wfGetDB( DB_SLAVE ),
178178 array( 'page_namespace' => $title->getNamespace(),
@@ -189,7 +189,7 @@
190190 * @static
191191 * @access public
192192 */
193 - function &fetchRevision( &$title ) {
 193+ function fetchRevision( &$title ) {
194194 return Revision::fetchFromConds(
195195 wfGetDB( DB_SLAVE ),
196196 array( 'rev_id=page_latest',
@@ -209,7 +209,7 @@
210210 * @static
211211 * @access private
212212 */
213 - function &fetchFromConds( &$db, $conditions ) {
 213+ function fetchFromConds( &$db, $conditions ) {
214214 $res = $db->select(
215215 array( 'page', 'revision' ),
216216 array( 'page_namespace',
@@ -301,7 +301,7 @@
302302 * Returns the title of the page associated with this entry.
303303 * @return Title
304304 */
305 - function &getTitle() {
 305+ function getTitle() {
306306 if( isset( $this->mTitle ) ) {
307307 return $this->mTitle;
308308 }
@@ -313,7 +313,7 @@
314314 'rev_id' => $this->mId ),
315315 'Revision::getTItle' );
316316 if( $row ) {
317 - $this->mTitle =& Title::makeTitle( $row->page_namespace,
 317+ $this->mTitle = Title::makeTitle( $row->page_namespace,
318318 $row->page_title );
319319 }
320320 return $this->mTitle;
@@ -389,7 +389,7 @@
390390 /**
391391 * @return Revision
392392 */
393 - function &getPrevious() {
 393+ function getPrevious() {
394394 $prev = $this->mTitle->getPreviousRevisionID( $this->mId );
395395 return Revision::newFromTitle( $this->mTitle, $prev );
396396 }
@@ -397,7 +397,7 @@
398398 /**
399399 * @return Revision
400400 */
401 - function &getNext() {
 401+ function getNext() {
402402 $next = $this->mTitle->getNextRevisionID( $this->mId );
403403 return Revision::newFromTitle( $this->mTitle, $next );
404404 }
@@ -601,7 +601,7 @@
602602 * @param bool $minor
603603 * @return Revision
604604 */
605 - function &newNullRevision( &$dbw, $pageId, $summary, $minor ) {
 605+ function newNullRevision( &$dbw, $pageId, $summary, $minor ) {
606606 $fname = 'Revision::newNullRevision';
607607 wfProfileIn( $fname );
608608
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -309,9 +309,9 @@
310310
311311 $dbr =& wfGetDB( DB_SLAVE );
312312 if( $this->mNewid ) {
313 - $this->newRev =& Revision::newFromId( $this->mNewid );
 313+ $this->newRev = Revision::newFromId( $this->mNewid );
314314 } else {
315 - $this->newRev =& Revision::newFromTitle( $wgTitle );
 315+ $this->newRev = Revision::newFromTitle( $wgTitle );
316316 }
317317 if( is_null( $this->newRev ) ) {
318318 return false;
@@ -332,9 +332,9 @@
333333 }
334334
335335 if( $this->mOldid ) {
336 - $this->oldRev =& Revision::newFromId( $this->mOldid );
 336+ $this->oldRev = Revision::newFromId( $this->mOldid );
337337 } else {
338 - $this->oldRev =& $this->newRev->getPrevious();
 338+ $this->oldRev = $this->newRev->getPrevious();
339339 $this->mOldid = $this->oldRev->getId();
340340 }
341341 if( is_null( $this->oldRev ) ) {
Index: trunk/phase3/includes/Namespace.php
@@ -100,7 +100,7 @@
101101 /**
102102 * Returns the canonical (English Wikipedia) name for a given index
103103 */
104 - function &getCanonicalName( $index ) {
 104+ function getCanonicalName( $index ) {
105105 global $wgCanonicalNamespaceNames;
106106 return $wgCanonicalNamespaceNames[$index];
107107 }
@@ -109,7 +109,7 @@
110110 * Returns the index for a given canonical name, or NULL
111111 * The input *must* be converted to lower case first
112112 */
113 - function &getCanonicalIndex( $name ) {
 113+ function getCanonicalIndex( $name ) {
114114 global $wgCanonicalNamespaceNames;
115115 static $xNamespaces = false;
116116 if ( $xNamespaces === false ) {
Index: trunk/phase3/includes/SkinTemplate.php
@@ -132,7 +132,7 @@
133133 * @return object
134134 * @access private
135135 */
136 - function &setupTemplate( $classname, $repository=false, $cache_dir=false ) {
 136+ function setupTemplate( $classname, $repository=false, $cache_dir=false ) {
137137 return new $classname();
138138 }
139139
@@ -161,7 +161,7 @@
162162 $this->mTitle =& $wgTitle;
163163 $this->mUser =& $wgUser;
164164
165 - $tpl =& $this->setupTemplate( $this->template, 'skins' );
 165+ $tpl = $this->setupTemplate( $this->template, 'skins' );
166166
167167 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
168168 $tpl->setTranslator(new MediaWiki_I18N());
@@ -483,7 +483,7 @@
484484 }
485485
486486
487 - function tabAction( &$title, $message, $selected, $query='', $checkEdit=false ) {
 487+ function tabAction( $title, $message, $selected, $query='', $checkEdit=false ) {
488488 $classes = array();
489489 if( $selected ) {
490490 $classes[] = 'selected';
Index: trunk/phase3/includes/Database.php
@@ -937,6 +937,9 @@
938938 * @return string
939939 */
940940 function makeUpdateOptions( $options ) {
 941+ if( !is_array( $options ) ) {
 942+ wfDebugDieBacktrace( 'makeUpdateOptions given non-array' );
 943+ }
941944 $opts = array();
942945 if ( in_array( 'LOW_PRIORITY', $options ) )
943946 $opts[] = $this->lowPriorityOption();
@@ -1453,7 +1456,7 @@
14541457 /**
14551458 * @todo document
14561459 */
1457 - function &resultObject( &$result ) {
 1460+ function resultObject( &$result ) {
14581461 if( empty( $result ) ) {
14591462 return NULL;
14601463 } else {
@@ -1565,7 +1568,7 @@
15661569 /**
15671570 * @todo document
15681571 */
1569 - function &fetchObject() {
 1572+ function fetchObject() {
15701573 return $this->db->fetchObject( $this->result );
15711574 }
15721575
Index: trunk/phase3/RELEASE-NOTES
@@ -587,6 +587,10 @@
588588 * Specify USE INDEX on Allpages chunk queries, sometimes gets lost
589589 due to bogus optimization
590590 * (bug 275) Section duplication fix
 591+* Remove unused use of undefined variable in UserMailer
 592+* Fix notice on search index update due to non-array
 593+* (bug 2885) Fix fatal errors and notices in PHP 5.1.0beta3
 594+* (bug 2931) Fix additional notices on reference use in PHP 4.4.0
591595
592596
593597 === Caveats ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r10316* (bug 2885, 2931) Problems with references in php 4.4 and 5.1avar19:47, 30 July 2005
r10514* New special page: SpecialMostlinked...avar02:59, 15 August 2005
r10516* New special page: SpecialMostlinked...avar03:04, 15 August 2005
r10521* (bug 2885, 2931) Bah, bugs with the thingalabong 4.4.0, 5.1 eep!avar12:07, 15 August 2005
r10819* (bug 2885) More PHP 5.1 fixes: skin, search, log, undeletevibber21:58, 28 August 2005
r10820* (bug 2885) More PHP 5.1 fixes: skin, search, log, undeletevibber21:59, 28 August 2005
r11577* (bug 2885) Remove unnecessary reference parameter which broke classic skin...vibber01:30, 30 October 2005
r11578* (bug 2885) Remove unnecessary reference parameter which broke classic skin...vibber01:30, 30 October 2005

Status & tagging log