Don't use isset() to check whether an existing variable is null
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Tue, 1 Jan 2013 21:13:30 +0000 (22:13 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Tue, 1 Jan 2013 21:13:30 +0000 (22:13 +0100)
Change-Id: I7b4207e91b6fa33ba31b1308f5e71f923def687e

includes/CategoryPage.php
includes/EditPage.php
includes/Export.php

index 32e270e..3e69dd4 100644 (file)
@@ -56,7 +56,7 @@ class CategoryPage extends Article {
                $diffOnly = $request->getBool( 'diffonly',
                        $this->getContext()->getUser()->getOption( 'diffonly' ) );
 
-               if ( isset( $diff ) && $diffOnly ) {
+               if ( $diff !== null && $diffOnly ) {
                        parent::view();
                        return;
                }
index ad6c98d..cf2b878 100644 (file)
@@ -610,7 +610,7 @@ class EditPage {
                                // modified by subclasses
                                wfProfileIn( get_class( $this ) . "::importContentFormData" );
                                $textbox1 = $this->importContentFormData( $request );
-                               if ( isset( $textbox1 ) ) {
+                               if ( $textbox1 !== null ) {
                                        $this->textbox1 = $textbox1;
                                }
 
index 45a5366..16c297e 100644 (file)
@@ -427,10 +427,10 @@ class WikiExporter {
        protected function outputPageStream( $resultset ) {
                $last = null;
                foreach ( $resultset as $row ) {
-                       if ( is_null( $last ) ||
+                       if ( $last === null ||
                                $last->page_namespace != $row->page_namespace ||
                                $last->page_title     != $row->page_title ) {
-                               if ( isset( $last ) ) {
+                               if ( $last !== null ) {
                                        $output = '';
                                        if ( $this->dumpUploads ) {
                                                $output .= $this->writer->writeUploads( $last, $this->dumpUploadFileContents );
@@ -445,7 +445,7 @@ class WikiExporter {
                        $output = $this->writer->writeRevision( $row );
                        $this->sink->writeRevision( $row, $output );
                }
-               if ( isset( $last ) ) {
+               if ( $last !== null ) {
                        $output = '';
                        if ( $this->dumpUploads ) {
                                $output .= $this->writer->writeUploads( $last, $this->dumpUploadFileContents );