r102353 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102352‎ | r102353 | r102354 >
Date:00:44, 8 November 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
properly check for empty strings
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_CompatibilityHelpers.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryLanguage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Container.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_URI.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Bool.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Number.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_String.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStoreLight.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUI.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUI.php
@@ -387,7 +387,7 @@
388388 // processing params for main result column
389389 if ( is_array( $mainColumnLabels ) ) {
390390 foreach ( $mainColumnLabels as $key => $label ) {
391 - if ( $label == '' ) {
 391+ if ( $label === '' ) {
392392 $po[$key] = "?";
393393 } else {
394394 $po[$key] = "? = $label";
@@ -398,7 +398,7 @@
399399 $categoryNamespace = $wgContLang->getNsText( NS_CATEGORY );
400400 if ( is_array( $categoryValues ) ) {
401401 foreach ( $categoryValues as $key => $value ) {
402 - if ( trim( $value ) == '' ) {
 402+ if ( trim( $value ) === '' ) {
403403 $po[$key] = "?$categoryNamespace" ;
404404 } else {
405405 $po[$key] = "?$categoryNamespace:$value";
@@ -429,7 +429,7 @@
430430 $params['order'] = '';
431431 foreach ( $propertyValues as $key => $propertyValue ) {
432432 $propertyValues[$key] = trim( $propertyValue );
433 - if ( $propertyValues[$key] == '' ) {
 433+ if ( $propertyValues[$key] === '' ) {
434434 unset( $propertyValues[$key] );
435435 }
436436 if ( $smwgQSortingSupport
@@ -441,10 +441,10 @@
442442 $params['order'] .= ( $params['order'] != '' ? ',':'' ) . $orderValues[$key];
443443 }
444444 }
445 - if ( $params['sort'] == '' ) {
 445+ if ( $params['sort'] === '' ) {
446446 unset ( $params['sort'] );
447447 }
448 - if ( $params['order'] == '' ) {
 448+ if ( $params['order'] === '' ) {
449449 unset ( $params['order'] );
450450 }
451451 $displayValues = $wgRequest->getArray( 'display' );
@@ -848,7 +848,7 @@
849849 ) .
850850 Xml::closeElement( 'div' );
851851 $urlArgs["category[$i]"] =
852 - ( $categoryValues[$key] == '' ) ? ' ':$categoryValues[$key];
 852+ ( $categoryValues[$key] === '' ) ? ' ':$categoryValues[$key];
853853
854854 $urlArgs["cat_label[$i]"] = $categoryLabelValues[$key];
855855 $urlArgs["cat_yes[$i]"] = $categoryYesValues[$key];
@@ -879,7 +879,7 @@
880880 '<a class="smwq-more" href="javascript:smw_makeQueryMatchesDialog(\'' . $i . '\')">' . wfMsg( 'smw_qui_options' ) . '</a> ' .
881881 '</div>';
882882 $urlArgs["maincol_label[$i]"] =
883 - ( $mainColumnLabels[$key] == '' ) ? ' ':$mainColumnLabels[$key];
 883+ ( $mainColumnLabels[$key] === '' ) ? ' ':$mainColumnLabels[$key];
884884 $i++;
885885 }
886886 }
@@ -1538,7 +1538,7 @@
15391539 if ( is_array( $orderValues ) ) {
15401540 $params['order'] = '';
15411541 foreach ( $orderValues as $order_value ) {
1542 - if ( $order_value == '' ) {
 1542+ if ( $order_value === '' ) {
15431543 $order_value = 'ASC';
15441544 }
15451545 $params['order'] .= ( $params['order'] != '' ? ',' : '' ) . $order_value;
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -208,7 +208,7 @@
209209
210210 $errors = array();
211211 if ( $enableValidation ) {
212 - if ( $queryString == '' ) {
 212+ if ( $queryString === '' ) {
213213 $errors[] = wfMsg( 'smw_qui_noquery' );
214214 } else {
215215 $query = SMWQueryProcessor::createQuery( $queryString, array() );
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -130,7 +130,7 @@
131131 $this->m_params['order'] = '';
132132
133133 foreach ( $order_values as $order_value ) {
134 - if ( $order_value == '' ) $order_value = 'ASC';
 134+ if ( $order_value === '' ) $order_value = 'ASC';
135135 $this->m_params['order'] .= ( $this->m_params['order'] != '' ? ',' : '' ) . $order_value;
136136 }
137137 }
@@ -148,20 +148,20 @@
149149
150150 if ( !array_key_exists( 'offset', $this->m_params ) ) {
151151 $this->m_params['offset'] = $wgRequest->getVal( 'offset' );
152 - if ( $this->m_params['offset'] == '' ) $this->m_params['offset'] = 0;
 152+ if ( $this->m_params['offset'] === '' ) $this->m_params['offset'] = 0;
153153 }
154154
155155 if ( !array_key_exists( 'limit', $this->m_params ) ) {
156156 $this->m_params['limit'] = $wgRequest->getVal( 'limit' );
157157
158 - if ( $this->m_params['limit'] == '' ) {
 158+ if ( $this->m_params['limit'] === '' ) {
159159 $this->m_params['limit'] = ( $this->m_params['format'] == 'rss' ) ? 10 : 20; // Standard limit for RSS.
160160 }
161161 }
162162
163163 $this->m_params['limit'] = min( $this->m_params['limit'], $smwgQMaxInlineLimit );
164164
165 - $this->m_editquery = ( $wgRequest->getVal( 'eq' ) == 'yes' ) || ( $this->m_querystring == '' );
 165+ $this->m_editquery = ( $wgRequest->getVal( 'eq' ) == 'yes' ) || ( $this->m_querystring === '' );
166166 }
167167
168168 /**
Index: trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php
@@ -25,8 +25,8 @@
2626 $wgOut->setPageTitle( wfMsg( 'exportrdf' ) );
2727
2828 // see if we can find something to export:
29 - $page = ( $page == '' ) ? $wgRequest->getVal( 'page' ) : rawurldecode( $page );
30 - if ( $page == '' ) { // Try to get POST list; some settings are only available via POST.
 29+ $page = ( $page === '' ) ? $wgRequest->getVal( 'page' ) : rawurldecode( $page );
 30+ if ( $page === '' ) { // Try to get POST list; some settings are only available via POST.
3131 $pageblob = $wgRequest->getText( 'pages' );
3232 if ( $pageblob != '' ) {
3333 $pages = explode( "\n", $pageblob );
@@ -89,7 +89,7 @@
9090 protected function startRDFExport() {
9191 global $wgOut, $wgRequest;
9292 $syntax = $wgRequest->getText( 'syntax' );
93 - if ( $syntax == '' ) $syntax = $wgRequest->getVal( 'syntax' );
 93+ if ( $syntax === '' ) $syntax = $wgRequest->getVal( 'syntax' );
9494 $wgOut->disable();
9595 ob_start();
9696 if ( $syntax == 'turtle' ) {
@@ -120,14 +120,14 @@
121121
122122 $recursive = 0; // default, no recursion
123123 $rec = $wgRequest->getText( 'recursive' );
124 - if ( $rec == '' ) $rec = $wgRequest->getVal( 'recursive' );
 124+ if ( $rec === '' ) $rec = $wgRequest->getVal( 'recursive' );
125125 if ( ( $rec == '1' ) && ( $smwgAllowRecursiveExport || $wgUser->isAllowed( 'delete' ) ) ) {
126126 $recursive = 1; // users may be allowed to switch it on
127127 }
128128
129129 $backlinks = $smwgExportBacklinks; // default
130130 $bl = $wgRequest->getText( 'backlinks' );
131 - if ( $bl == '' ) $bl = $wgRequest->getVal( 'backlinks' );
 131+ if ( $bl === '' ) $bl = $wgRequest->getVal( 'backlinks' );
132132 if ( ( $bl == '1' ) && ( $wgUser->isAllowed( 'delete' ) ) ) {
133133 $backlinks = true; // admins can always switch on backlinks
134134 } elseif ( ( $bl == '0' ) || ( '' == $bl && $postform ) ) {
@@ -135,7 +135,7 @@
136136 }
137137
138138 $date = $wgRequest->getText( 'date' );
139 - if ( $date == '' ) $date = $wgRequest->getVal( 'date' );
 139+ if ( $date === '' ) $date = $wgRequest->getVal( 'date' );
140140 if ( $date != '' ) {
141141 $timeint = strtotime( $date );
142142 $stamp = date( "YmdHis", $timeint );
Index: trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php
@@ -29,7 +29,7 @@
3030
3131 wfProfileIn( 'SpecialURIResolver::execute (SMW)' );
3232
33 - if ( $query == '' ) {
 33+ if ( $query === '' ) {
3434 if ( stristr( $_SERVER['HTTP_ACCEPT'], 'RDF' ) ) {
3535 $wgOut->redirect( SpecialPage::getTitleFor( 'ExportRDF' )->getFullURL( 'stats=1' ), '303' );
3636 } else {
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php
@@ -83,11 +83,11 @@
8484 $typeDataValue = SMWTypesValue::newFromTypeId( $typeid );
8585 $propertyDataValue = SMWDataValueFactory::newDataItemValue( $result[0], null );
8686 $typestring = $typeDataValue->getLongHTMLText( $linker );
87 - if ( $typestring == '' ) $typestring = '–'; /// FIXME some types of builtin props have no name, and another message should be used then
 87+ if ( $typestring === '' ) $typestring = '–'; /// FIXME some types of builtin props have no name, and another message should be used then
8888 $proplink = $propertyDataValue->getLongHTMLText( $linker );
8989 }
9090
91 - if ( $typestring == '' ) {
 91+ if ( $typestring === '' ) {
9292 global $smwgPDefaultType;
9393 $typeDataValue = SMWTypesValue::newFromTypeId( $smwgPDefaultType );
9494 $typestring = $typeDataValue->getLongHTMLText( $linker );
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -65,8 +65,8 @@
6666 reset( $params );
6767
6868 // no GET parameters? Then try the URL
69 - if ( $this->propertystring == '' ) $this->propertystring = current( $params );
70 - if ( $this->valuestring == '' ) $this->valuestring = next( $params );
 69+ if ( $this->propertystring === '' ) $this->propertystring = current( $params );
 70+ if ( $this->valuestring === '' ) $this->valuestring = next( $params );
7171
7272 $this->valuestring = str_replace( '&nbsp;', ' ', $this->valuestring );
7373 $this->valuestring = str_replace( '&#160;', ' ', $this->valuestring );
@@ -110,7 +110,7 @@
111111 global $wgOut, $smwgSearchByPropertyFuzzy;
112112 $linker = smwfGetLinker();
113113
114 - if ( $this->propertystring == '' ) {
 114+ if ( $this->propertystring === '' ) {
115115 return '<p>' . wfMsg( 'smw_sbv_docu' ) . "</p>\n";
116116 }
117117
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php
@@ -54,14 +54,14 @@
5555 // get the GET parameters
5656 $this->articletext = $wgRequest->getVal( 'article' );
5757 // no GET parameters? Then try the URL
58 - if ( $this->articletext == '' ) {
 58+ if ( $this->articletext === '' ) {
5959 $params = SMWInfolink::decodeParameters( $query, false );
6060 reset( $params );
6161 $this->articletext = current( $params );
6262 }
6363 $this->subject = SMWDataValueFactory::newTypeIDValue( '_wpg', $this->articletext );
6464 $offsettext = $wgRequest->getVal( 'offset' );
65 - $this->offset = ( $offsettext == '' ) ? 0:intval( $offsettext );
 65+ $this->offset = ( $offsettext === '' ) ? 0:intval( $offsettext );
6666 $dir = $wgRequest->getVal( 'dir' );
6767 if ( $smwgBrowseShowAll ) {
6868 $this->showoutgoing = true;
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php
@@ -39,10 +39,10 @@
4040 $limit = $wgRequest->getVal( 'limit' );
4141 $offset = $wgRequest->getVal( 'offset' );
4242
43 - if ( $limit == '' ) $limit = 20;
44 - if ( $offset == '' ) $offset = 0;
 43+ if ( $limit === '' ) $limit = 20;
 44+ if ( $offset === '' ) $offset = 0;
4545
46 - if ( $propname == '' ) { // No GET parameters? Try the URL:
 46+ if ( $propname === '' ) { // No GET parameters? Try the URL:
4747 $queryparts = explode( '::', $query );
4848 $propname = $query;
4949 if ( count( $queryparts ) > 1 ) {
@@ -58,7 +58,7 @@
5959
6060 // Produce output
6161 $html = '';
62 - if ( ( $propname == '' ) ) { // no property given, show a message
 62+ if ( ( $propname === '' ) ) { // no property given, show a message
6363 $html .= wfMsg( 'smw_pp_docu' ) . "\n";
6464 } else { // property given, find and display results
6565 // FIXME: very ugly, needs i18n
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php
@@ -77,7 +77,7 @@
7878 * @return boolean
7979 */
8080 public function isBlankNode() {
81 - return ( $this->m_uri == '' ) || ( $this->m_uri{0} == '_' );
 81+ return ( $this->m_uri === '' ) || ( $this->m_uri{0} == '_' );
8282 }
8383
8484 /**
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php
@@ -184,7 +184,7 @@
185185 }
186186 $ed = self::getDataItemExpElement( $dataItem );
187187 if ( $ed !== null ) {
188 - if ( ( $property->getKey() == '_CONC' ) && ( $ed->getSubject()->getUri() == '' ) ) {
 188+ if ( ( $property->getKey() == '_CONC' ) && ( $ed->getSubject()->getUri() === '' ) ) {
189189 // equivalent to anonymous class -> simplify description
190190 foreach ( $ed->getProperties() as $subp ) {
191191 if ( $subp->getUri() != self::getSpecialNsResource( 'rdf', 'type' )->getUri() ) {
@@ -256,7 +256,7 @@
257257 $modifier = $diWikiPage->getSubobjectName();
258258 }
259259
260 - if ( $modifier == '' ) {
 260+ if ( $modifier === '' ) {
261261 $importProperty = new SMWDIProperty( '_IMPO' );
262262 $importDis = smwfGetStore()->getPropertyValues( $diWikiPage, $importProperty );
263263 $importURI = ( count( $importDis ) > 0 );
@@ -276,7 +276,7 @@
277277 $namespaceId = 'property';
278278 $localName = self::encodeURI( rawurlencode( $diWikiPage->getDBkey() ) );
279279 }
280 - if ( ( $localName == '' ) ||
 280+ if ( ( $localName === '' ) ||
281281 ( in_array( $localName{0}, array( '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ) ) ) ) {
282282 $namespace = self::getNamespaceUri( 'wiki' );
283283 $namespaceId = 'wiki';
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php
@@ -199,7 +199,7 @@
200200 }
201201 }
202202 }
203 - $this->post_ns_buffer .= ( $bnode ? " ]" : " ." ) . ( $indent == '' ? "\n\n" : '' );
 203+ $this->post_ns_buffer .= ( $bnode ? " ]" : " ." ) . ( $indent === '' ? "\n\n" : '' );
204204 }
205205
206206 protected function serializeExpLiteral( SMWExpLiteral $element ) {
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer.php
@@ -178,7 +178,7 @@
179179 * (what is flushed is gone).
180180 */
181181 public function flushContent() {
182 - if ( ( $this->pre_ns_buffer == '' ) && ( $this->post_ns_buffer == '' ) ) return '';
 182+ if ( ( $this->pre_ns_buffer === '' ) && ( $this->post_ns_buffer === '' ) ) return '';
183183 $this->serializeNamespaces();
184184 $result = $this->pre_ns_buffer . $this->post_ns_buffer;
185185 $this->pre_ns_buffer = '';
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -239,7 +239,7 @@
240240 $param = $name . '=' . $param;
241241 }
242242
243 - if ( $param == '' ) {
 243+ if ( $param === '' ) {
244244 } elseif ( $param { 0 } == '?' ) { // print statement
245245 $param = substr( $param, 1 );
246246 $parts = explode( '=', $param, 2 );
@@ -247,7 +247,7 @@
248248
249249 $data = null;
250250
251 - if ( trim( $propparts[0] ) == '' ) { // print "this"
 251+ if ( trim( $propparts[0] ) === '' ) { // print "this"
252252 $printmode = SMWPrintRequest::PRINT_THIS;
253253 $label = ''; // default
254254 $title = null;
@@ -275,7 +275,7 @@
276276
277277 if ( count( $propparts ) == 1 ) { // no outputformat found, leave empty
278278 $propparts[] = false;
279 - } elseif ( trim( $propparts[1] ) == '' ) { // "plain printout", avoid empty string to avoid confusions with "false"
 279+ } elseif ( trim( $propparts[1] ) === '' ) { // "plain printout", avoid empty string to avoid confusions with "false"
280280 $propparts[1] = '-';
281281 }
282282
@@ -390,7 +390,7 @@
391391 if ( ( $query->querymode == SMWQuery::MODE_INSTANCES ) || ( $query->querymode == SMWQuery::MODE_NONE ) ) {
392392 wfProfileIn( 'SMWQueryProcessor::getResultFromQuery-printout (SMW)' );
393393
394 - if ( $format == '' ) {
 394+ if ( $format === '' ) {
395395 $format = self::getResultFormat( $params );
396396 }
397397
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryLanguage.php
@@ -54,7 +54,7 @@
5555 */
5656 public static function getComparatorFromString( $string, $defaultComparator = SMW_CMP_EQ ) {
5757 self::initializeComparators();
58 - if ( $string == '' ) return SMW_CMP_EQ;
 58+ if ( $string === '' ) return SMW_CMP_EQ;
5959 return array_key_exists( $string, self::$comparators ) ? self::$comparators[$string] : $defaultComparator;
6060 }
6161
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php
@@ -133,7 +133,7 @@
134134 $value = '';
135135 }
136136
137 - if ( $value == '' ) { // silently ignore empty values
 137+ if ( $value === '' ) { // silently ignore empty values
138138 wfProfileOut( 'smwfParsePropertiesCallback (SMW)' );
139139 return '';
140140 }
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php
@@ -24,7 +24,7 @@
2525 }
2626
2727 protected function parseUserValueOrQuery( $value, $queryMode ) {
28 - if ( $value == '' ) {
 28+ if ( $value === '' ) {
2929 $this->addError( wfMsg( 'smw_novalues' ) );
3030
3131 if ( $queryMode ) {
@@ -62,7 +62,7 @@
6363 }
6464
6565 // generating the DVs:
66 - if ( ( $values[$valueIndex] == '' ) || ( $values[$valueIndex] == '?' ) ) { // explicit omission
 66+ if ( ( $values[$valueIndex] === '' ) || ( $values[$valueIndex] == '?' ) ) { // explicit omission
6767 $valueIndex++;
6868 } else {
6969 $dataValue = SMWDataValueFactory::newPropertyObjectValue( $diProperty, $values[$valueIndex] );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Number.php
@@ -85,7 +85,7 @@
8686 }
8787 }
8888
89 - if ( ( count( $parts ) == 1 ) || ( $numstring == '' ) ) { // no number found
 89+ if ( ( count( $parts ) == 1 ) || ( $numstring === '' ) ) { // no number found
9090 return 1;
9191 } elseif ( is_infinite( $number ) ) { // number is too large for this platform
9292 return 2;
@@ -276,7 +276,7 @@
277277 protected function convertToMainUnit( $number, $unit ) {
278278 $this->m_dataitem = new SMWDINumber( $number );
279279 $this->m_unitin = '';
280 - return ( $unit == '' );
 280+ return ( $unit === '' );
281281 }
282282
283283 /**
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Bool.php
@@ -65,7 +65,7 @@
6666 if ( $formatstring == $this->m_outformat ) return;
6767 unset( $this->m_truecaption );
6868 unset( $this->m_falsecaption );
69 - if ( $formatstring == '' ) { // no format
 69+ if ( $formatstring === '' ) { // no format
7070 // (unsetting the captions is exactly the right thing here)
7171 } elseif ( strtolower( $formatstring ) == '-' ) { // "plain" format
7272 $this->m_truecaption = 'true';
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php
@@ -526,7 +526,7 @@
527527 * @return integer that encodes a three-digit bit vector
528528 */
529529 protected static function checkDateComponent( $component, &$numvalue ) {
530 - if ( $component == '' ) { // should not happen
 530+ if ( $component === '' ) { // should not happen
531531 $numvalue = 0;
532532 return 0;
533533 } elseif ( is_numeric( $component ) ) {
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php
@@ -58,7 +58,7 @@
5959 }
6060
6161 $scheme = $hierpart = $query = $fragment = '';
62 - if ( $value == '' ) { // do not accept empty strings
 62+ if ( $value === '' ) { // do not accept empty strings
6363 $this->addError( wfMsgForContent( 'smw_emptystring' ) );
6464 $this->m_dataitem = new SMWDIUri( 'http', '//example.com', '', '', $this->m_typeid ); // define data item to have some value
6565 return;
@@ -181,7 +181,7 @@
182182
183183 public function getShortWikiText( $linked = null ) {
184184 $url = $this->getURL();
185 - if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url == '' ) || ( $this->m_caption == '' ) ) {
 185+ if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) {
186186 return $this->m_caption;
187187 } else {
188188 return '[' . $url . ' ' . $this->m_caption . ']';
@@ -190,7 +190,7 @@
191191
192192 public function getShortHTMLText( $linker = null ) {
193193 $url = $this->getURL();
194 - if ( is_null( $linked ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url == '' ) || ( $this->m_caption == '' ) ) {
 194+ if ( is_null( $linked ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) {
195195 return $this->m_caption;
196196 } else {
197197 return $linker->makeExternalLink( $url, $this->m_caption );
@@ -202,7 +202,7 @@
203203 return $this->getErrorText();
204204 }
205205 $url = $this->getURL();
206 - if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url == '' ) ) {
 206+ if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) {
207207 return $this->m_wikitext;
208208 } else {
209209 return '[' . $url . ' ' . $this->m_wikitext . ']';
@@ -214,7 +214,7 @@
215215 return $this->getErrorText();
216216 }
217217 $url = $this->getURL();
218 - if ( is_null( $linked ) || ( $this->m_outformat == '-' ) || ( $url == '' ) ) {
 218+ if ( is_null( $linked ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) {
219219 return htmlspecialchars( $this->m_wikitext );
220220 } else {
221221 return $linker->makeExternalLink( $url, $this->m_wikitext );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php
@@ -392,7 +392,7 @@
393393 */
394394 public function getPrefixedText() {
395395 global $wgContLang;
396 - if ( $this->m_prefixedtext == '' ) {
 396+ if ( $this->m_prefixedtext === '' ) {
397397 if ( $this->isValid() ) {
398398 $nstext = $wgContLang->getNSText( $this->m_dataitem->getNamespace() );
399399 $this->m_prefixedtext =
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php
@@ -56,7 +56,7 @@
5757
5858 $this->m_givenLabel = smwfNormalTitleText( $value );
5959 $this->m_typeId = SMWDataValueFactory::findTypeID( $this->m_givenLabel );
60 - if ( $this->m_typeId == '' ) {
 60+ if ( $this->m_typeId === '' ) {
6161 $this->addError( wfMsgForContent( 'smw_unknowntype', $this->m_givenLabel ) );
6262 $this->m_realLabel = $this->m_givenLabel;
6363 } else {
@@ -80,7 +80,7 @@
8181 protected function loadDataItem( SMWDataItem $dataItem ) {
8282 if ( ( $dataItem instanceof SMWDIUri ) && ( $dataItem->getScheme() == 'http' ) &&
8383 ( $dataItem->getHierpart() == 'semantic-mediawiki.org/swivt/1.0' ) &&
84 - ( $dataItem->getQuery() == '' ) ) {
 84+ ( $dataItem->getQuery() === '' ) ) {
8585 $this->m_isAlias = false;
8686 $this->m_typeId = $dataItem->getFragment();
8787 $this->m_realLabel = SMWDataValueFactory::findTypeLabel( $this->m_typeId );
@@ -94,7 +94,7 @@
9595
9696 public function getShortWikiText( $linked = null ) {
9797 global $wgContLang;
98 - if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) {
 98+ if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption === '' ) ) {
9999 return $this->m_caption;
100100 } else {
101101 $titleText = $this->getSpecialPageTitleText();
@@ -104,7 +104,7 @@
105105 }
106106
107107 public function getShortHTMLText( $linked = null ) {
108 - if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) {
 108+ if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption === '' ) ) {
109109 return htmlspecialchars( $this->m_caption );
110110 } else {
111111 $title = Title::makeTitle( NS_SPECIAL, $this->getSpecialPageTitleText() );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_String.php
@@ -18,7 +18,7 @@
1919 if ( $this->m_caption === false ) {
2020 $this->m_caption = ( $this->m_typeid == '_cod' ) ? $this->getCodeDisplay( $value ) : $value;
2121 }
22 - if ( $value == '' ) {
 22+ if ( $value === '' ) {
2323 $this->addError( wfMsgForContent( 'smw_emptystring' ) );
2424 }
2525
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php
@@ -51,10 +51,10 @@
5252 $result = '';
5353 if ( $outputmode == SMW_OUTPUT_FILE ) { // make RSS feed
5454 if ( !$smwgRSSEnabled ) return '';
55 - if ( $this->m_title == '' ) {
 55+ if ( $this->m_title === '' ) {
5656 $this->m_title = $wgSitename;
5757 }
58 - if ( $this->m_description == '' ) {
 58+ if ( $this->m_description === '' ) {
5959 $this->m_description = wfMsg( 'smw_rss_description', $wgSitename );
6060 }
6161
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
@@ -52,7 +52,7 @@
5353 $headers[] = Html::rawElement(
5454 'th',
5555 $attribs,
56 - $text == '' ? '&nbsp;' : $text
 56+ $text === '' ? '&nbsp;' : $text
5757 );
5858 }
5959
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
@@ -178,7 +178,7 @@
179179 $this->m_errors[] = wfMsgForContent( 'smw_toomanyclosing', $chunk );
180180 return null;
181181 }
182 - } elseif ( $chunk == '' ) {
 182+ } elseif ( $chunk === '' ) {
183183 $continue = false;
184184 }
185185 break;
@@ -422,7 +422,7 @@
423423
424424 $list = preg_split( '/:/', $chunk, 3 ); // ":Category:Foo" "User:bar" ":baz" ":+"
425425
426 - if ( ( $list[0] == '' ) && ( count( $list ) == 3 ) ) {
 426+ if ( ( $list[0] === '' ) && ( count( $list ) == 3 ) ) {
427427 $list = array_slice( $list, 1 );
428428 }
429429 if ( ( count( $list ) == 2 ) && ( $list[1] == '+' ) ) { // try namespace restriction
@@ -488,7 +488,7 @@
489489 $chunk = $this->readChunk( '\]\]' );
490490 }
491491 }
492 - if ( $chunk == '' ) {
 492+ if ( $chunk === '' ) {
493493 $this->m_errors[] = wfMsgForContent( 'smw_noclosingbrackets' );
494494 }
495495 }
@@ -514,7 +514,7 @@
515515 * query string.
516516 */
517517 protected function readChunk( $stoppattern = '', $consume = true, $trim = true ) {
518 - if ( $stoppattern == '' ) {
 518+ if ( $stoppattern === '' ) {
519519 $stoppattern = '\[\[|\]\]|::|:=|<q>|<\/q>' .
520520 '|^' . $this->m_categoryprefix . '|^' . $this->m_categoryPrefixCannonical .
521521 '|^' . $this->m_conceptprefix . '|^' . $this->m_conceptPrefixCannonical .
@@ -528,7 +528,7 @@
529529
530530 return $trim ? trim( $chunks[0] ) : $chunks[0];
531531 } elseif ( count( $chunks ) == 3 ) { // this should generally happen if count is not 1
532 - if ( $chunks[0] == '' ) { // string started with delimiter
 532+ if ( $chunks[0] === '' ) { // string started with delimiter
533533 if ( $consume ) {
534534 $this->m_curstring = $chunks[2];
535535 }
Index: trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
@@ -203,13 +203,13 @@
204204 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_queryEndpoint );
205205 curl_setopt( $this->m_curlhandle, CURLOPT_NOBODY, true );
206206 } elseif ( $endpointType == self::EP_TYPE_UPDATE ) {
207 - if ( $this->m_updateEndpoint == '' ) {
 207+ if ( $this->m_updateEndpoint === '' ) {
208208 return false;
209209 }
210210 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_updateEndpoint );
211211 curl_setopt( $this->m_curlhandle, CURLOPT_NOBODY, false ); // 4Store gives 404 instead of 500 with CURLOPT_NOBODY
212212 } else { // ( $endpointType == self::EP_TYPE_DATA )
213 - if ( $this->m_dataEndpoint == '' ) {
 213+ if ( $this->m_dataEndpoint === '' ) {
214214 return false;
215215 } else { // try an empty POST
216216 return $this->doHttpPost( '' );
@@ -480,7 +480,7 @@
481481 * @return boolean
482482 */
483483 public function doUpdate( $sparql ) {
484 - if ( $this->m_updateEndpoint == '' ) {
 484+ if ( $this->m_updateEndpoint === '' ) {
485485 throw new SMWSparqlDatabaseError( SMWSparqlDatabaseError::ERROR_NOSERVICE, $sparql, 'not specified' );
486486 }
487487 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_updateEndpoint );
@@ -518,7 +518,7 @@
519519 * @return SMWSparqlResultWrapper
520520 */
521521 public function doHttpPost( $payload ) {
522 - if ( $this->m_dataEndpoint == '' ) {
 522+ if ( $this->m_dataEndpoint === '' ) {
523523 throw new SMWSparqlDatabaseError( SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload", 'not specified' );
524524 }
525525 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_dataEndpoint .
Index: trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php
@@ -96,7 +96,7 @@
9797 * @return SMWSparqlResultWrapper
9898 */
9999 public function doHttpPost( $payload ) {
100 - if ( $this->m_dataEndpoint == '' ) {
 100+ if ( $this->m_dataEndpoint === '' ) {
101101 throw new SMWSparqlDatabaseError( SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload", 'not specified' );
102102 }
103103 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_dataEndpoint );
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
@@ -442,7 +442,7 @@
443443 if ( $asvalue ) {
444444 return $comparator . $dataValue->getWikiValue();
445445 } else { // this only is possible for values of Type:Page
446 - if ( $comparator == '' ) { // some extra care for Category: pages
 446+ if ( $comparator === '' ) { // some extra care for Category: pages
447447 return '[[:' . $dataValue->getWikiValue() . ']]';
448448 } else {
449449 return '[[' . $comparator . $dataValue->getWikiValue() . ']]';
@@ -512,7 +512,7 @@
513513 $result .= ( $result ? ' ' : '' ) . $desc->getQueryString( false );
514514 }
515515
516 - if ( $result == '' ) {
 516+ if ( $result === '' ) {
517517 return $asvalue ? '+' : '';
518518 } else { // <q> not needed for stand-alone conjunctions (AND binds stronger than OR)
519519 return $asvalue ? " &lt;q&gt;{$result}&lt;/q&gt; " : $result;
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStoreLight.php
@@ -272,7 +272,7 @@
273273 $updates = array(); // collect data for bulk updates; format: tableid => updatearray
274274 foreach ( $data->getProperties() as $property ) {
275275 $tablename = SMWSQLStoreLight::findPropertyTableName( $property );
276 - if ( $tablename == '' ) continue;
 276+ if ( $tablename === '' ) continue;
277277 foreach ( $data->getPropertyValues( $property ) as $dv ) {
278278 if ( !$dv->isValid() ) continue;
279279 if ( $dv instanceof SMWContainerValue ) {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -295,7 +295,7 @@
296296 $entries['SQL Query'] =
297297 "<tt>SELECT DISTINCT $qobj->alias.smw_title AS t,$qobj->alias.smw_namespace AS ns FROM " .
298298 $this->m_dbs->tableName( $qobj->jointable ) . " AS $qobj->alias" . $qobj->from .
299 - ( ( $qobj->where == '' ) ? '':' WHERE ' ) . $qobj->where . "$tailOpts LIMIT " .
 299+ ( ( $qobj->where === '' ) ? '':' WHERE ' ) . $qobj->where . "$tailOpts LIMIT " .
300300 $sql_options['LIMIT'] . ' OFFSET ' . $sql_options['OFFSET'] . ';</tt>';
301301 } else {
302302 $entries['SQL Query'] = 'Empty result, no SQL query created.';
@@ -395,7 +395,7 @@
396396
397397 while ( ( $count < $query->getLimit() ) && ( $row = $this->m_dbs->fetchObject( $res ) ) ) {
398398 $count++;
399 - if ( $row->iw == '' || $row->iw{0} != ':' ) {
 399+ if ( $row->iw === '' || $row->iw{0} != ':' ) {
400400 $v = new SMWDIWikiPage( $row->t, $row->ns, $row->iw, $row->so );
401401 $qr[] = $v;
402402 $this->m_store->cacheSMWPageID( $row->id, $row->t, $row->ns, $row->iw, $row->so );
@@ -578,7 +578,7 @@
579579 $tableid = SMWSQLStore2::findPropertyTableID( $property );
580580 $typeid = $property->findPropertyTypeID();
581581
582 - if ( $tableid == '' ) { // Still no table to query? Give up.
 582+ if ( $tableid === '' ) { // Still no table to query? Give up.
583583 $query->type = SMW_SQL2_NOQUERY;
584584 return;
585585 }
@@ -772,7 +772,7 @@
773773 }
774774 }
775775
776 - if ( $where == '' ) { // comparators did not apply; match all fields
 776+ if ( $where === '' ) { // comparators did not apply; match all fields
777777 $i = 0;
778778
779779 foreach ( $proptable->objectfields as $fname => $ftype ) {
@@ -830,7 +830,7 @@
831831 $condition = "($condition)";
832832 }
833833
834 - $query->where .= ( ( $query->where == '' ) ? '':' AND ' ) . $condition;
 834+ $query->where .= ( ( $query->where === '' ) ? '':' AND ' ) . $condition;
835835 } else { // interpret empty joinfields as impossible condition (empty result)
836836 $query->joinfield = ''; // make whole query false
837837 $query->jointable = '';
@@ -840,7 +840,7 @@
841841 }
842842
843843 if ( $subquery->where != '' ) {
844 - $query->where .= ( ( $query->where == '' ) ? '':' AND ' ) . '(' . $subquery->where . ')';
 844+ $query->where .= ( ( $query->where === '' ) ? '':' AND ' ) . '(' . $subquery->where . ')';
845845 }
846846
847847 $query->from .= $subquery->from;
@@ -1051,7 +1051,7 @@
10521052
10531053 foreach ( $this->m_sortkeys as $propkey => $order ) {
10541054 if ( !array_key_exists( $propkey, $qobj->sortfields ) ) { // Find missing property to sort by.
1055 - if ( $propkey == '' ) { // Sort by first result column (page titles).
 1055+ if ( $propkey === '' ) { // Sort by first result column (page titles).
10561056 $qobj->sortfields[$propkey] = "$qobj->alias.smw_sortkey";
10571057 } else { // Try to extend query.
10581058 $extrawhere = '';
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
@@ -279,7 +279,7 @@
280280
281281 if ( $sparqlCondition instanceof SMWSparqlSingletonCondition ) {
282282 $matchElement = $sparqlCondition->matchElement;
283 - if ( $sparqlCondition->condition == '' ) { // all URIs exist, no querying
 283+ if ( $sparqlCondition->condition === '' ) { // all URIs exist, no querying
284284 return 1;
285285 } else {
286286 $condition = $this->getSparqlConditionString( $sparqlCondition );
@@ -319,7 +319,7 @@
320320
321321 if ( $sparqlCondition instanceof SMWSparqlSingletonCondition ) {
322322 $matchElement = $sparqlCondition->matchElement;
323 - if ( $sparqlCondition->condition == '' ) { // all URIs exist, no querying
 323+ if ( $sparqlCondition->condition === '' ) { // all URIs exist, no querying
324324 $results = array( array ( $matchElement ) );
325325 } else {
326326 $condition = $this->getSparqlConditionString( $sparqlCondition );
@@ -358,7 +358,7 @@
359359
360360 if ( $sparqlCondition instanceof SMWSparqlSingletonCondition ) {
361361 $matchElement = $sparqlCondition->matchElement;
362 - if ( $sparqlCondition->condition == '' ) { // all URIs exist, no querying
 362+ if ( $sparqlCondition->condition === '' ) { // all URIs exist, no querying
363363 $sparql = 'None (no conditions).';
364364 } else {
365365 $condition = $this->getSparqlConditionString( $sparqlCondition );
@@ -392,7 +392,7 @@
393393 */
394394 protected function getSparqlConditionString( SMWSparqlCondition &$sparqlCondition ) {
395395 $condition = $sparqlCondition->getWeakConditionString();
396 - if ( ( $condition == '' ) && !$sparqlCondition->isSafe() ) {
 396+ if ( ( $condition === '' ) && !$sparqlCondition->isSafe() ) {
397397 $swivtPageResource = SMWExporter::getSpecialNsResource( 'swivt', 'page' );
398398 $condition = '?' . self::RESULT_VARIABLE . ' ' . $swivtPageResource->getQName() . " ?url .\n";
399399 }
@@ -564,7 +564,7 @@
565565 }
566566 $result = new SMWSparqlSingletonCondition( $singletonMatchElement, $condition,
567567 $hasSafeSubconditions, $namespaces );
568 - } elseif ( $condition == '' ) {
 568+ } elseif ( $condition === '' ) {
569569 $result = new SMWSparqlFilterCondition( $filter, $namespaces );
570570 } else {
571571 if ( $filter != '' ) {
@@ -620,7 +620,7 @@
621621 if ( $matchElement instanceof SMWExpNsResource ) {
622622 $namespaces[$matchElement->getNamespaceId()] = $matchElement->getNamespace();
623623 }
624 - if ( $subCondition->condition == '' ) {
 624+ if ( $subCondition->condition === '' ) {
625625 $filter .= ( $filter ? ' || ' : '' ) . "?$joinVariable = $matchElementName";
626626 } else {
627627 $unionCondition .= ( $unionCondition ? ' UNION ' : '' ) .
@@ -631,11 +631,11 @@
632632 $weakConditions = array_merge( $weakConditions, $subCondition->weakConditions );
633633 }
634634
635 - if ( ( $unionCondition == '' ) && ( $filter == '' ) ) {
 635+ if ( ( $unionCondition === '' ) && ( $filter === '' ) ) {
636636 return new SMWSparqlFalseCondition();
637 - } elseif ( $unionCondition == '' ) {
 637+ } elseif ( $unionCondition === '' ) {
638638 $result = new SMWSparqlFilterCondition( $filter, $namespaces );
639 - } elseif ( $filter == '' ) {
 639+ } elseif ( $filter === '' ) {
640640 $result = new SMWSparqlWhereCondition( $unionCondition, $hasSafeSubconditions, $namespaces );
641641 } else {
642642 $subJoinVariable = $this->getNextVariable();
@@ -742,14 +742,14 @@
743743 $categoryName = SMWTurtleSerializer::getTurtleNameForExpElement( $categoryExpElement );
744744 $namespaces[$categoryExpElement->getNamespaceId()] = $categoryExpElement->getNamespace();
745745 $newcondition = "{ ?$joinVariable " . $instExpElement->getQName() . " $categoryName . }\n";
746 - if ( $condition == '' ) {
 746+ if ( $condition === '' ) {
747747 $condition = $newcondition;
748748 } else {
749749 $condition .= "UNION\n$newcondition";
750750 }
751751 }
752752
753 - if ( $condition == '' ) { // empty disjunction: always false, no results to order
 753+ if ( $condition === '' ) { // empty disjunction: always false, no results to order
754754 return new SMWSparqlFalseCondition();
755755 }
756756
@@ -804,7 +804,7 @@
805805 default: $comparator = ''; // unkown, unsupported
806806 }
807807
808 - if ( $comparator == '' ) {
 808+ if ( $comparator === '' ) {
809809 $result = $this->buildTrueCondition( $joinVariable, $orderByProperty );
810810 } elseif ( $comparator == '=' ) {
811811 $expElement = SMWExporter::getDataItemHelperExpElement( $dataItem );
@@ -922,7 +922,7 @@
923923 protected function addMissingOrderByConditions( SMWSparqlCondition &$sparqlCondition ) {
924924 foreach ( $this->m_sortkeys as $propkey => $order ) {
925925 if ( !array_key_exists( $propkey, $sparqlCondition->orderVariables ) ) { // Find missing property to sort by.
926 - if ( $propkey == '' ) { // order by result page sortkey
 926+ if ( $propkey === '' ) { // order by result page sortkey
927927 $this->addOrderByData( $sparqlCondition, self::RESULT_VARIABLE, SMWDataItem::TYPE_WIKIPAGE );
928928 $sparqlCondition->orderVariables[$propkey] = $sparqlCondition->orderByVariable;
929929 } else { // extend query to order by other property values
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php
@@ -472,7 +472,7 @@
473473 foreach ( $query->getErrors() as $error ) {
474474 $errors .= $error . '<br />';
475475 }
476 - if ( $errors == '' ) {
 476+ if ( $errors === '' ) {
477477 $errors = 'None';
478478 }
479479 $entries['Errors and Warnings'] = $errors;
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -136,7 +136,7 @@
137137 // *** Prepare the cache ***//
138138 if ( !array_key_exists( $sid, $this->m_semdata ) ) { // new cache entry
139139 $this->m_semdata[$sid] = new SMWSqlStubSemanticData( $subject, false );
140 - if ( $subject->getSubobjectName() == '' ) { // no sortkey for subobjects
 140+ if ( $subject->getSubobjectName() === '' ) { // no sortkey for subobjects
141141 $this->m_semdata[$sid]->addPropertyStubValue( '_SKEY', array( $sortkey ) );
142142 }
143143 $this->m_sdstate[$sid] = array();
@@ -202,7 +202,7 @@
203203 $pid = $this->getSMWPropertyID( $property );
204204 $tableid = self::findPropertyTableID( $property );
205205
206 - if ( ( $pid == 0 ) || ( $tableid == '' ) ) {
 206+ if ( ( $pid == 0 ) || ( $tableid === '' ) ) {
207207 wfProfileOut( "SMWSQLStore2::getPropertyValues (SMW)" );
208208 return array();
209209 }
@@ -369,7 +369,7 @@
370370
371371 // Filter out any accidentally retrieved internal things (interwiki starts with ":"):
372372 if ( $proptable->getFieldSignature() != 'p' || count( $valuekeys ) < 3 ||
373 - $valuekeys[2] == '' || $valuekeys[2]{0} != ':' ) {
 373+ $valuekeys[2] === '' || $valuekeys[2]{0} != ':' ) {
374374 $result[] = $issubject ? array( $propertyname, $valuekeys ) : $valuekeys;
375375 }
376376 }
@@ -405,7 +405,7 @@
406406 $pid = $this->getSMWPropertyID( $property );
407407 $tableid = self::findPropertyTableID( $property );
408408
409 - if ( ( $pid == 0 ) || ( $tableid == '' ) ) {
 409+ if ( ( $pid == 0 ) || ( $tableid === '' ) ) {
410410 wfProfileOut( "SMWSQLStoreLight::getPropertySubjects (SMW)" );
411411 return array();
412412 }
@@ -437,7 +437,7 @@
438438
439439 foreach ( $res as $row ) {
440440 try {
441 - if ( $row->smw_iw == '' || $row->smw_iw{0} != ':' ) { // filter special objects
 441+ if ( $row->smw_iw === '' || $row->smw_iw{0} != ':' ) { // filter special objects
442442 $result[] = new SMWDIWikiPage( $row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject );
443443 }
444444 } catch ( SMWDataItemException $e ) {
@@ -568,7 +568,7 @@
569569
570570 if ( $proptable->idsubject ) {
571571 $where = 's_id=' . $db->addQuotes( $sid );
572 - } elseif ( $subject->getInterwiki() == '' ) {
 572+ } elseif ( $subject->getInterwiki() === '' ) {
573573 $where = 's_title=' . $db->addQuotes( $subject->getDBkey() ) . ' AND s_namespace=' . $db->addQuotes( $subject->getNamespace() );
574574 } else { // subjects with non-emtpy interwiki cannot have properties
575575 continue;
@@ -1492,7 +1492,7 @@
14931493
14941494 if ( $row->smw_subobject != '' ) {
14951495 // leave subobjects alone; they ought to be changed with their pages
1496 - } elseif ( $row->smw_iw == '' || $row->smw_iw == SMW_SQL2_SMWREDIIW ) { // objects representing pages
 1496+ } elseif ( $row->smw_iw === '' || $row->smw_iw == SMW_SQL2_SMWREDIIW ) { // objects representing pages
14971497 // TODO: special treament of redirects needed, since the store will
14981498 // not act on redirects that did not change according to its records
14991499 $title = Title::makeTitleSafe( $row->smw_namespace, $row->smw_title );
@@ -1924,7 +1924,7 @@
19251925
19261926 $id = $this->m_idCache->getId( $title, $namespace, $iw, $subobjectName );
19271927 if ( $id == 0 && $smwgQEqualitySupport != SMW_EQ_NONE
1928 - && $subobjectName == '' && $iw == '' ) {
 1928+ && $subobjectName === '' && $iw === '' ) {
19291929 $iw = SMW_SQL2_SMWREDIIW;
19301930 $id = $this->m_idCache->getId( $title, $namespace, SMW_SQL2_SMWREDIIW, $subobjectName );
19311931 }
@@ -1966,7 +1966,7 @@
19671967 $this->m_idCache->setId( $title, $namespace, $row->smw_iw, $subobjectName, $row->smw_id );
19681968
19691969 if ( $row->smw_iw == SMW_SQL2_SMWREDIIW && $canonical &&
1970 - $subobjectName == '' && $smwgQEqualitySupport != SMW_EQ_NONE ) {
 1970+ $subobjectName === '' && $smwgQEqualitySupport != SMW_EQ_NONE ) {
19711971 $id = $this->getRedirectId( $title, $namespace );
19721972 $this->m_idCache->setId( $title, $namespace, $iw, $subobjectName, 0 );
19731973 } else {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php
@@ -70,7 +70,7 @@
7171 if ( $interwiki == SMW_SQL2_SMWREDIIW ) {
7272 $hashKey = self::getHashKey( $title, $namespace, '', $subobject );
7373 $this->m_data[$hashKey] = 0;
74 - } // could do this for $interwiki == '' too, but the SMW_SQL2_SMWREDIIW would be useless
 74+ } // could do this for $interwiki === '' too, but the SMW_SQL2_SMWREDIIW would be useless
7575 }
7676
7777 public function deleteId( $title, $namespace, $interwiki, $subobject ) {
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_CompatibilityHelpers.php
@@ -55,7 +55,7 @@
5656 if ( ( count( $dbkeys ) == 2 ) && ( count( $timedate ) == 2 ) ) {
5757 $date = reset( $timedate );
5858 $year = $month = $day = $hours = $minutes = $seconds = $timeoffset = false;
59 - if ( ( end( $timedate ) == '' ) ||
 59+ if ( ( end( $timedate ) === '' ) ||
6060 ( SMWTimeValue::parseTimeString( end( $timedate ), $hours, $minutes, $seconds, $timeoffset ) == true ) ) {
6161 $d = explode( '/', $date, 3 );
6262 if ( count( $d ) == 3 ) {
@@ -65,8 +65,8 @@
6666 } elseif ( count( $d ) == 1 ) {
6767 list( $year ) = $d;
6868 }
69 - if ( $month == '' ) $month = false;
70 - if ( $day == '' ) $day = false;
 69+ if ( $month === '' ) $month = false;
 70+ if ( $day === '' ) $day = false;
7171 $calendarmodel = SMWDITime::CM_GREGORIAN;
7272 return new SMWDITime( $calendarmodel, $year, $month, $day, $hours, $minutes, $seconds );
7373 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php
@@ -262,7 +262,7 @@
263263 if ( array_key_exists( $propertyKey, $this->mProperties ) ) {
264264 $property = $this->mProperties[$propertyKey];
265265 } else {
266 - if ( self::$mPropertyPrefix == '' ) {
 266+ if ( self::$mPropertyPrefix === '' ) {
267267 global $wgContLang;
268268 self::$mPropertyPrefix = $wgContLang->getNsText( SMW_NS_PROPERTY ) . ':';
269269 } // explicitly use prefix to cope with things like [[Property:User:Stupid::somevalue]]
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_URI.php
@@ -49,10 +49,10 @@
5050 * @todo Implement more validation here.
5151 */
5252 public function __construct( $scheme, $hierpart, $query, $fragment ) {
53 - if ( ( $scheme == '' ) || ( preg_match( '/[^a-zA-Z]/u', $scheme ) ) ) {
 53+ if ( ( $scheme === '' ) || ( preg_match( '/[^a-zA-Z]/u', $scheme ) ) ) {
5454 throw new SMWDataItemException( "Illegal URI scheme \"$scheme\"." );
5555 }
56 - if ( $hierpart == '' ) {
 56+ if ( $hierpart === '' ) {
5757 throw new SMWDataItemException( "Illegal URI hierpart \"$hierpart\"." );
5858 }
5959 $this->m_scheme = $scheme;
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php
@@ -94,7 +94,7 @@
9595 * @return mixed Title or null
9696 */
9797 public function getTitle() {
98 - if ( $this->m_interwiki == '' ) {
 98+ if ( $this->m_interwiki === '' ) {
9999 return Title::makeTitleSafe( $this->m_namespace, $this->m_dbkey, $this->m_subobjectname );
100100 } else { // TODO inefficient; incomplete for fragments (see above commment)
101101 $datavalue = new SMWWikiPageValue( '_wpg' );
@@ -104,7 +104,7 @@
105105 }
106106
107107 public function getSerialization() {
108 - if ( $this->m_subobjectname == '' ) {
 108+ if ( $this->m_subobjectname === '' ) {
109109 return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki );
110110 } else {
111111 return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki . '#' . $this->m_subobjectname );
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Container.php
@@ -55,7 +55,7 @@
5656 public function hasAnonymousSubject() {
5757 if ( $this->mSubject->getNamespace() == NS_SPECIAL &&
5858 $this->mSubject->getDBkey() == 'SMWInternalObject' &&
59 - $this->mSubject->getInterwiki() == '' ) {
 59+ $this->mSubject->getInterwiki() === '' ) {
6060 return true;
6161 } else {
6262 return false;
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php
@@ -72,7 +72,7 @@
7373 * @param $inverse boolean states if the inverse of the property is constructed
7474 */
7575 public function __construct( $key, $inverse = false ) {
76 - if ( ( $key == '' ) || ( $key{0} == '-' ) ) {
 76+ if ( ( $key === '' ) || ( $key{0} == '-' ) ) {
7777 throw new SMWDataItemException( "Illegal property key \"$key\"." );
7878 }
7979 if ( $key{0} == '_' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r102355Follow up to r102353;jeroendedauw00:52, 8 November 2011
r102410Fix for r102353 - replaced "=== ''" with is_null(), to get it working againyaron16:16, 8 November 2011