e107inc/e107

View on GitHub
e107_handlers/e_db_pdo_class.php

Summary

Maintainability
C
1 day
Test Coverage
B
88%

Consider simplifying this complex logical expression.
Open

        if($table && !$where && is_bool($fields))
        {
            // table is the query, fields used for multi
            if($fields)
            {
Severity: Major
Found in e107_handlers/e_db_pdo_class.php - About 40 mins to fix

    Avoid too many return statements within this method.
    Open

                    return e107::getParser()->toNumber($fieldValue);
    Severity: Major
    Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return "'".$this->escape($fieldValue, false)."'";
      Severity: Major
      Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return e107::getParser()->toDB($fieldValue);
        Severity: Major
        Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return false;
          Severity: Major
          Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $ret;
            Severity: Major
            Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return "'".e107::getParser()->toDB($fieldValue)."'";
              Severity: Major
              Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return array();
                Severity: Major
                Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    if($fieldValue == '') { return "''"; }
                    Severity: Major
                    Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $this->rowCount();
                      Severity: Major
                      Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return ($fieldValue && $fieldValue !== 'NULL' ? "'".$this->escape($fieldValue, false)."'" : 'NULL');
                        Severity: Major
                        Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return "'". (string) $fieldValue."'";
                          Severity: Major
                          Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            if($fieldValue == '') { return ''; }
                            Severity: Major
                            Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return array();
                              Severity: Major
                              Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                    return array();
                                Severity: Major
                                Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return "'".e107::serialize($fieldValue, true)."'";
                                  Severity: Major
                                  Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return array();
                                    Severity: Major
                                    Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                      return false;
                                      Severity: Major
                                      Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return $fieldValue;
                                        Severity: Major
                                        Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return $this->fetch();
                                          Severity: Major
                                          Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return false;
                                            Severity: Major
                                            Found in e107_handlers/e_db_pdo_class.php - About 30 mins to fix

                                              Assigning string to property but \e_db_pdo->mySQLlastErrNum is int
                                              Open

                                                          $this->mySQLlastErrNum = $e->getCode();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (tStart) is string but \e107_traffic::Bump() takes int defined at /code/e107_handlers/traffic_class.php:90
                                              Open

                                                      $this->traffic->Bump('db_Query', $b, $e);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (tStart) is string but \e107_traffic::Bump() takes int defined at /code/e107_handlers/traffic_class.php:90
                                              Open

                                                          $this->traffic->Bump('db_Fetch', $b);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($this->mySQLresult = $this->db_Query('SELECT '.$fields.' FROM '.$this->mySQLPrefix.$table.' WHERE '.$arg, NULL, 'db_Select', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type null but dbError() is declared to return string
                                              Open

                                                          return null;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning string to property but \e_db_pdo->mySQLlastErrNum is int
                                              Open

                                                              $this->mySQLlastErrNum = $ex->getCode();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but count() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                      if (($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) === false)
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Reference to constant NONE from undeclared class \Ifsnop\Mysqldump\Mysqldump
                                              Open

                                                          'compress'                      => !empty($options['gzip']) ? Ifsnop\Mysqldump\Mysqldump::GZIP : Ifsnop\Mysqldump\Mysqldump::NONE,
                                              Severity: Critical
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type null but _getPDOValue() is declared to return int|string
                                              Open

                                                              ) ? $fieldValue : null;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type ?\PDOStatement|?bool|?int but copyTable() is declared to return bool|int
                                              Open

                                                      return $result;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning array{} to property but \e_db_pdo->pdoBind is false
                                              Open

                                                      $this->pdoBind = array();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but count() is declared to return int
                                              Open

                                                          return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning null to property but \e_db_pdo->mySQLaccess is \PDO
                                              Open

                                                      $this->mySQLaccess = null; // correct way to do it when using shared links.
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (fields) is ?'*'|?string but \e_db_pdo::select() takes string defined at /code/e107_handlers/e_db_pdo_class.php:661
                                              Open

                                                              if($select && !$this->select($table, $fields, $where, $noWhere, $debug))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($this->mySQLresult = $this->db_Query('SELECT '.$fields.' FROM '.$this->mySQLPrefix.$table, NULL, 'db_Select', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (haystack) is string but \in_array() takes array
                                              Open

                                                                  if (strtoupper($fields) == 'ALL' || in_array ($key, $fields))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 3 (tFinish) is string but \e107_traffic::Bump() takes int defined at /code/e107_handlers/traffic_class.php:90
                                              Open

                                                      $this->traffic->Bump('db_Query', $b, $e);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (value) is int|string but \e_db_pdo::_getPDOType() takes null defined at /code/e107_handlers/e_db_pdo_class.php:1284
                                              Open

                                                                  $this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype,$this->_getPDOValue($ftype,$fv)));
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Call to method start from undeclared class \Ifsnop\Mysqldump\Mysqldump
                                              Open

                                                          $dump->start($backupFile);
                                              Severity: Critical
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                      $result = $this->mySQLresult = $this->db_Query($query, NULL, 'db_Update', $debug, $log_type, $log_remark);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              When fetching an array index from a value of type array|true, found an array index of type true, but expected the index to be of type int|string
                                              Open

                                                                          $list[$row[$ordermode]][$key] = $value;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($this->mySQLresult = $this->db_Query($query, null, 'db_Select', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                      $this->mySQLresult = $this->db_Query($query, NULL, 'db_Insert', $debug, $log_type, $log_remark);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Saw possibly unextractable annotation for a fragment of comment '* @param string fields to retrieve': after string, did not see an element name (will guess based on comment order)
                                              Open

                                                  * @param string fields to retrieve
                                              Severity: Info
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Expected @param annotation for order to be before the @param annotation for where
                                              Open

                                                   * @param string $where (Optional ) where condition.
                                              Severity: Info
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Reference to constant GZIP from undeclared class \Ifsnop\Mysqldump\Mysqldump
                                              Open

                                                          'compress'                      => !empty($options['gzip']) ? Ifsnop\Mysqldump\Mysqldump::GZIP : Ifsnop\Mysqldump\Mysqldump::NONE,
                                              Severity: Critical
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning string to property but \e_db_pdo->mySQLlastErrNum is int
                                              Open

                                                              $this->mySQLlastErrNum = $ex->getCode();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning int to property but \e_db_pdo->total_results is false
                                              Open

                                                          $this->total_results = intval($rc);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but select() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.$this->mySQLPrefix.$table, NULL, 'db_Delete', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Call to method __construct from undeclared class \Ifsnop\Mysqldump\Mysqldump
                                              Open

                                                          $dump = new Ifsnop\Mysqldump\Mysqldump("mysql:host={$this->mySQLserver};port={$this->mySQLport};dbname={$this->mySQLdefaultdb}", $this->mySQLuser, $this->mySQLpassword, $dumpSettings);
                                              Severity: Critical
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning array<string>&gt;|array<string>&gt;</string></string> to property but \e_db_pdo->pdoBind is false
                                              Open

                                                                  $this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype,$this->_getPDOValue($ftype,$fv)));
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but update() is declared to return int
                                              Open

                                                          return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                      if ($this->mySQLresult = $this->db_Query($query, NULL, 'db_Count', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but delete() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.$this->mySQLPrefix.$table.' WHERE '.$arg, NULL, 'db_Delete', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but select() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($this->mySQLresult = $this->db_Query($query, NULL, 'db_Count', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Default value for object $mode can't be string
                                              Open

                                                  public function tables($mode='all')
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Reference to undeclared property \e_db_pdo->mySQLLastErrNum (Did you mean expr->mySQLlastErrNum)
                                              Open

                                                          $this->mySQLLastErrNum = $ex->getCode();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (fields) is ?'*'|?string but \e_db_pdo::select() takes string defined at /code/e107_handlers/e_db_pdo_class.php:661
                                              Open

                                                              if($select && !$this->select($table, $fields, $where, $noWhere, $debug))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (fields) is ?'*'|?string but \e_db_pdo::select() takes string defined at /code/e107_handlers/e_db_pdo_class.php:661
                                              Open

                                                              if($select && !$this->select($table, $fields, $where, $noWhere, $debug))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                          if ($this->mySQLresult = $this->db_Query('SELECT '.$fields.' FROM '.$this->mySQLPrefix.$table.' '.$arg, NULL, 'db_Select', $debug, $log_type, $log_remark))
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but select() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Suspicious array access to false
                                              Open

                                                                  $this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype,$this->_getPDOValue($ftype,$fv)));
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (value) is int|string but \e_db_pdo::_getPDOType() takes null defined at /code/e107_handlers/e_db_pdo_class.php:1284
                                              Open

                                                              $bind[$fk] = array('value'=>$this->_getPDOValue($fieldType,$fv), 'type'=> $this->_getPDOType($fieldType,$this->_getPDOValue($fieldType,$fv)));
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but update() is declared to return int
                                              Open

                                                          if ($result === -1) { return false; }    // Error return from mysql_affected_rows
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (rli) is null but \e_db_pdo::db_Query() takes object defined at /code/e107_handlers/e_db_pdo_class.php:329
                                              Open

                                                              $this->db_Query("ALTER TABLE ".$this->mySQLPrefix.$table."  AUTO_INCREMENT=1", NULL, 'db_Insert', $debug, $log_type, $log_remark);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Assigning array<string>[]|array<string>[]</string></string> to property but \e_db_pdo->pdoBind is false
                                              Open

                                                                  $this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype,$this->_getPDOValue($ftype,$fv)));
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but delete() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Returning type false but select() is declared to return int
                                              Open

                                                              return false;
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Argument 2 (fields) is true but \e_db_pdo::retrieve() takes string defined at /code/e107_handlers/e_db_pdo_class.php:525
                                              Open

                                                      $result = $this->retrieve("SHOW INDEXES FROM #".$table, true);
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Reference to undeclared property \e_db_pdo->mysqlLastErrText (Did you mean expr->mySQLlastErrText)
                                              Open

                                                              $this->mysqlLastErrText = "copyRow \$fields list was empty";
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Class \db defined at /code/e107_handlers/e_db_pdo_class.php:2823 was previously defined as Class \db at /code/e107_handlers/mysql_class.php:2712
                                              Open

                                              class db extends e_db_pdo
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              Reference to undeclared property \e_db_pdo->mysqlLastErrText (Did you mean expr->mySQLlastErrText)
                                              Open

                                                          $this->mysqlLastErrText = 'mysqldump-php error: ' .$e->getMessage();
                                              Severity: Minor
                                              Found in e107_handlers/e_db_pdo_class.php by phan

                                              There are no issues that match your filters.

                                              Category
                                              Status