Use (int) rather than intval()
[lhc/web/wiklou.git] / includes / api / ApiQueryCategories.php
index c4428d5..547a4e8 100644 (file)
@@ -1,9 +1,5 @@
 <?php
 /**
- *
- *
- * Created on May 13, 2007
- *
  * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
@@ -69,7 +65,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
                $this->addTables( 'categorylinks' );
                $this->addWhereFld( 'cl_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
-               if ( !is_null( $params['categories'] ) ) {
+               if ( $params['categories'] ) {
                        $cats = [];
                        foreach ( $params['categories'] as $cat ) {
                                $title = Title::newFromText( $cat );
@@ -79,6 +75,10 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                                        $cats[] = $title->getDBkey();
                                }
                        }
+                       if ( !$cats ) {
+                               // No titles so no results
+                               return;
+                       }
                        $this->addWhereFld( 'cl_to', $cats );
                }
 
@@ -86,7 +86,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
-                       $clfrom = intval( $cont[0] );
+                       $clfrom = (int)$cont[0];
                        $clto = $this->getDB()->addQuotes( $cont[1] );
                        $this->addWhere(
                                "cl_from $op $clfrom OR " .