From 93154120cc0a10d7984099ac5f8ac489377976b5 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Tue, 11 Jul 2006 14:11:23 +0000 Subject: [PATCH] Remove forced dereferencements (new() returns a reference in PHP5) --- RELEASE-NOTES | 1 + includes/DifferenceEngine.php | 4 ++-- includes/ImagePage.php | 2 +- includes/Skin.php | 2 +- includes/SpecialLog.php | 4 ++-- includes/SpecialUndelete.php | 4 ++-- includes/SpecialUserlogin.php | 4 ++-- includes/Title.php | 4 ++-- includes/normal/CleanUpTest.php | 2 +- includes/normal/RandomTest.php | 6 +++--- maintenance/FiveUpgrade.inc | 2 +- maintenance/backup.inc | 2 +- maintenance/diffLanguage.php | 2 +- maintenance/parserTests.inc | 4 ++-- maintenance/parserTests.php | 2 +- tests/DatabaseTest.php | 4 ++-- tests/RunTests.php | 2 +- tests/SearchMySQL4Test.php | 4 ++-- 18 files changed, 28 insertions(+), 27 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7634b142b5..1a92f67ecf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -49,6 +49,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN {{REVISIONID}} when Cite extension is used * (bug 6622) Removed deprecated function image::newFromTitle * (bug 6627) Fix regression in Special:Ipblocklist with table prefix +* Removed forced dereferencements (new() returns a reference in PHP5) == Languages updated == diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 741b7199ce..4871a54214 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -411,8 +411,8 @@ CONTROL; # Native PHP diff $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) ); $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) ); - $diffs =& new Diff( $ota, $nta ); - $formatter =& new TableDiffFormatter(); + $diffs = new Diff( $ota, $nta ); + $formatter = new TableDiffFormatter(); return $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) ); } diff --git a/includes/ImagePage.php b/includes/ImagePage.php index dac9602d4a..8a865a9d30 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -373,7 +373,7 @@ END $line = $this->img->nextHistoryLine(); if ( $line ) { - $list =& new ImageHistoryList( $sk ); + $list = new ImageHistoryList( $sk ); $s = $list->beginImageHistoryList() . $list->imageHistoryLine( true, wfTimestamp(TS_MW, $line->img_timestamp), $this->mTitle->getDBkey(), $line->img_user, diff --git a/includes/Skin.php b/includes/Skin.php index 1631f1a7f6..c0a75a67b8 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -133,7 +133,7 @@ class Skin extends Linker { $className = 'SkinStandard'; require_once( "{$wgStyleDirectory}/Standard.php" ); } - $skin =& new $className; + $skin = new $className; return $skin; } diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index a9e8573ac9..e32d224034 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -28,11 +28,11 @@ */ function wfSpecialLog( $par = '' ) { global $wgRequest; - $logReader =& new LogReader( $wgRequest ); + $logReader = new LogReader( $wgRequest ); if( $wgRequest->getVal( 'type' ) == '' && $par != '' ) { $logReader->limitType( $par ); } - $logViewer =& new LogViewer( $logReader ); + $logViewer = new LogViewer( $logReader ); $logViewer->show(); } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 695c8c2934..e01e36d7c8 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -500,7 +500,7 @@ class UndeleteForm { if(!preg_match("/[0-9]{14}/",$timestamp)) return 0; - $archive =& new PageArchive( $this->mTargetObj ); + $archive = new PageArchive( $this->mTargetObj ); $text = $archive->getRevisionText( $timestamp ); $wgOut->setPagetitle( wfMsg( "undeletepage" ) ); @@ -620,7 +620,7 @@ class UndeleteForm { # Show relevant lines from the deletion log: $wgOut->addHTML( "

" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); require_once( 'SpecialLog.php' ); - $logViewer =& new LogViewer( + $logViewer = new LogViewer( new LogReader( new FauxRequest( array( 'page' => $this->mTargetObj->getPrefixedText(), diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 5f72ee94e6..c66947cc70 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -522,12 +522,12 @@ class LoginForm { require_once( 'templates/Userlogin.php' ); if ( $this->mType == 'signup' ) { - $template =& new UsercreateTemplate(); + $template = new UsercreateTemplate(); $q = 'action=submitlogin&type=signup'; $linkq = 'type=login'; $linkmsg = 'gotaccount'; } else { - $template =& new UserloginTemplate(); + $template = new UserloginTemplate(); $q = 'action=submitlogin&type=login'; $linkq = 'type=signup'; $linkmsg = 'nologin'; diff --git a/includes/Title.php b/includes/Title.php index 2ac2e6499b..8cb51de457 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -132,7 +132,7 @@ class Title { */ $filteredText = Sanitizer::decodeCharReferences( $text ); - $t =& new Title(); + $t = new Title(); $t->mDbkeyform = str_replace( ' ', '_', $filteredText ); $t->mDefaultNamespace = $defaultNamespace; @@ -234,7 +234,7 @@ class Title { * @access public */ public static function &makeTitle( $ns, $title ) { - $t =& new Title(); + $t = new Title(); $t->mInterwiki = ''; $t->mFragment = ''; $t->mNamespace = intval( $ns ); diff --git a/includes/normal/CleanUpTest.php b/includes/normal/CleanUpTest.php index 4e147cfd99..30ec6a95fc 100644 --- a/includes/normal/CleanUpTest.php +++ b/includes/normal/CleanUpTest.php @@ -412,7 +412,7 @@ class CleanUpTest extends PHPUnit_TestCase { } -$suite =& new PHPUnit_TestSuite( 'CleanUpTest' ); +$suite = new PHPUnit_TestSuite( 'CleanUpTest' ); $result = PHPUnit::run( $suite ); echo $result->toString(); diff --git a/includes/normal/RandomTest.php b/includes/normal/RandomTest.php index 3a5a407be8..e2601366df 100644 --- a/includes/normal/RandomTest.php +++ b/includes/normal/RandomTest.php @@ -65,8 +65,8 @@ function showDiffs( $a, $b ) { $ota = explode( "\n", str_replace( "\r\n", "\n", $a ) ); $nta = explode( "\n", str_replace( "\r\n", "\n", $b ) ); - $diffs =& new Diff( $ota, $nta ); - $formatter =& new TableDiffFormatter(); + $diffs = new Diff( $ota, $nta ); + $formatter = new TableDiffFormatter(); $funky = $formatter->format( $diffs ); preg_match_all( '/(.*?)<\/span>/', $funky, $matches ); foreach( $matches[1] as $bit ) { @@ -104,4 +104,4 @@ while( true ) { $norm = ''; } -?> \ No newline at end of file +?> diff --git a/maintenance/FiveUpgrade.inc b/maintenance/FiveUpgrade.inc index 7caf6810ef..f56e62b48e 100644 --- a/maintenance/FiveUpgrade.inc +++ b/maintenance/FiveUpgrade.inc @@ -64,7 +64,7 @@ class FiveUpgrade { function &newConnection() { global $wgDBadminuser, $wgDBadminpassword; global $wgDBserver, $wgDBname; - $db =& new Database( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); + $db = new Database( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); return $db; } diff --git a/maintenance/backup.inc b/maintenance/backup.inc index d3603bd10e..12dab66a46 100644 --- a/maintenance/backup.inc +++ b/maintenance/backup.inc @@ -221,7 +221,7 @@ class BackupDumper { global $wgDBadminuser, $wgDBadminpassword; global $wgDBname, $wgDebugDumpSql; $flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // god-damn hack - $db =& new Database( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags ); + $db = new Database( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags ); $timeout = 3600 * 24; $db->query( "SET net_read_timeout=$timeout" ); $db->query( "SET net_write_timeout=$timeout" ); diff --git a/maintenance/diffLanguage.php b/maintenance/diffLanguage.php index eb87b3bab0..92af31e564 100644 --- a/maintenance/diffLanguage.php +++ b/maintenance/diffLanguage.php @@ -128,7 +128,7 @@ if ( isset($args[0]) ) { } /** parsertest is used to do differences */ -$myParserTest =& new ParserTest(); +$myParserTest = new ParserTest(); # Get all references messages and check if they exist in the tested language $i = 0; diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 30cba310a8..c27f0100de 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -238,7 +238,7 @@ class ParserTest { $this->setupGlobals($opts); - $user =& new User(); + $user = new User(); $options = ParserOptions::newFromUser( $user ); if (preg_match('/\\bmath\\b/i', $opts)) { @@ -255,7 +255,7 @@ class ParserTest { $noxml = (bool)preg_match( '~\\b noxml \\b~x', $opts ); - $parser =& new Parser(); + $parser = new Parser(); foreach( $this->hooks as $tag => $callback ) { $parser->setHook( $tag, $callback ); } diff --git a/maintenance/parserTests.php b/maintenance/parserTests.php index eac7adb045..309bf2e07c 100644 --- a/maintenance/parserTests.php +++ b/maintenance/parserTests.php @@ -49,7 +49,7 @@ END; # refer to $wgTitle directly, but instead use the title # passed to it. $wgTitle = Title::newFromText( 'Parser test script do not use' ); -$tester =& new ParserTest(); +$tester = new ParserTest(); if( isset( $options['file'] ) ) { $file = $options['file']; diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index a721c98d40..edb785dd01 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -13,7 +13,7 @@ class DatabaseTest extends PHPUnit_TestCase { } function setUp() { - $this->db =& new Database(); + $this->db = new Database(); } function tearDown() { @@ -90,4 +90,4 @@ class DatabaseTest extends PHPUnit_TestCase { } -?> \ No newline at end of file +?> diff --git a/tests/RunTests.php b/tests/RunTests.php index ec04fc037f..2b539a4795 100644 --- a/tests/RunTests.php +++ b/tests/RunTests.php @@ -57,7 +57,7 @@ foreach( $tests as $test ) { function &buildTestDatabase( $serverType, $tables ) { global $testOptions, $wgDBprefix; $wgDBprefix = 'parsertest'; - $db =& new Database( + $db = new Database( $testOptions[$serverType]['server'], $testOptions[$serverType]['user'], $testOptions[$serverType]['password'], diff --git a/tests/SearchMySQL4Test.php b/tests/SearchMySQL4Test.php index 545af23048..a18e22c603 100644 --- a/tests/SearchMySQL4Test.php +++ b/tests/SearchMySQL4Test.php @@ -18,7 +18,7 @@ class SearchMySQL4Test extends SearchEngine_TestCase { if( $this->db ) { $this->insertSearchData(); } - $this->search =& new SearchMySQL4( $this->db ); + $this->search = new SearchMySQL4( $this->db ); } function tearDown() { @@ -31,4 +31,4 @@ class SearchMySQL4Test extends SearchEngine_TestCase { } -?> \ No newline at end of file +?> -- 2.20.1