e107inc/e107

View on GitHub
e107_handlers/mysql_class.php

Summary

Maintainability
C
1 day
Test Coverage
B
84%

Consider simplifying this complex logical expression.
Open

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

    Avoid too many return statements within this method.
    Open

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

      Avoid too many return statements within this method.
      Open

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

        Avoid too many return statements within this method.
        Open

                            return array();
        Severity: Major
        Found in e107_handlers/mysql_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/mysql_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/mysql_class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return FALSE;
              Severity: Major
              Found in e107_handlers/mysql_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/mysql_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/mysql_class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

                                            return array();
                        Severity: Major
                        Found in e107_handlers/mysql_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/mysql_class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return e107::getParser()->toNumber($fieldValue);
                            Severity: Major
                            Found in e107_handlers/mysql_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/mysql_class.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

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

                                  Assigning false to property but \e_db_mysql->mySQLerror is string
                                  Open

                                          $this->mySQLerror       = false;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

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

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

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

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Assigning bool to property but \e_db_mysql->mySQLerror is string
                                  Open

                                          $this->mySQLerror = $mode;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Default value for string $newLink can't be false
                                  Open

                                      public function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $newLink = FALSE, $mySQLPrefix = MPREFIX)
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Returning type true but db_Connect() is declared to return null|string
                                  Open

                                          return true;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_class.php by phan

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 4 (dbname) is bool|false but \mysqli_connect() takes string
                                  Open

                                          if (!$this->mySQLaccess = @mysqli_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword, $newLink))
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Assigning array|null to property but \e_db_mysql->mySQLrows is int
                                  Open

                                                  $rows = $this->mySQLrows = @mysqli_fetch_array($this->mySQLresult);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_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/mysql_class.php by phan

                                  Variable $mySQLuser is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_class.php by phan

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Assigning int to property but \e_db_mysql->mySQLresult is \mysqli_result|bool|false
                                  Open

                                              $this->mySQLresult = mysqli_affected_rows($this->mySQLaccess);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

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

                                  Call to undeclared method \e_db::get_mySQLaccess
                                  Open

                                              $this->mySQLaccess = e107::getDb()->get_mySQLaccess();
                                  Severity: Critical
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLdefaultdb is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLserver is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Reference to undeclared constant \MYSQLI_REPORT_OFF
                                  Open

                                          mysqli_report(MYSQLI_REPORT_OFF);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

                                                  if($select && !$this->select($table, $fields, $where, $noWhere, $debug))
                                  Severity: Minor
                                  Found in e107_handlers/mysql_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/mysql_class.php by phan

                                  Reference to undeclared constant \MYSQL_LIGHT
                                  Open

                                      $path = (MYSQL_LIGHT !== true ? MYSQL_LIGHT : '');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLdefaultdb is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLserver is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Parameter $rli has undeclared type \mysqli
                                  Open

                                      public function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '')
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

                                              return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

                                          $this->mysqlLastErrText = "PDO is required to use the mysql backup() method";
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLuser is undeclared
                                  Open

                                      $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLpassword is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Property \e_db_mysql->mySQLaccess has undeclared type \mysqli
                                  Open

                                      protected   $mySQLaccess;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

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

                                  Call to method set_charset from undeclared class \mysqli
                                  Invalid

                                              $this->mySQLaccess->set_charset($charset);
                                  Severity: Critical
                                  Found in e107_handlers/mysql_class.php by phan

                                  Assigning false to property but \e_db_mysql->mySQLerror is string
                                  Open

                                          $this->mySQLerror         = false;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Return type of db_Query() is undeclared type \mysqli_result
                                  Open

                                      public function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '')
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

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

                                  Checking instanceof against undeclared class \mysqli_result
                                  Open

                                          if ($result instanceof mysqli_result)
                                  Severity: Critical
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

                                        if ($result = $this->mySQLresult = $this->db_Query('UPDATE '.$this->mySQLPrefix.$table.' SET '.$new_data.$vars.' '.$arg, NULL, 'db_UpdateArray', $debug, $log_type, $log_remark))
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_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/mysql_class.php by phan

                                  Saw possibly unextractable annotation for a fragment of comment '* @param bool TRUE enter debug mode. default FALSE': after bool, did not see an element name (will guess based on comment order)
                                  Open

                                       * @param bool      TRUE enter debug mode. default FALSE
                                  Severity: Info
                                  Found in e107_handlers/mysql_class.php by phan

                                  Return type of get_mySQLaccess() is undeclared type \mysqli
                                  Open

                                      public function get_mySQLaccess()
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLpassword is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Returning type null but db_Mark_Time() is declared to return void
                                  Open

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

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_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/mysql_class.php by phan

                                  Returning type ?\mysqli_result|?bool|?int but db_CopyTable() is declared to return \mysqli_result|bool|int
                                  Open

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

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

                                                      $this->db_Query("SET NAMES `$charset`", NULL, '', $debug);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLpassword is undeclared
                                  Open

                                      $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Parameter $result has undeclared type \mysqli_result
                                  Open

                                      public function rowCount($result=null)
                                  Severity: Minor
                                  Found in e107_handlers/mysql_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/mysql_class.php by phan

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

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

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

                                              $this->total_results = (int)$rc['FOUND_ROWS()'];
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

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

                                  Return type of db_CopyTable() is undeclared type \mysqli_result
                                  Open

                                      function db_CopyTable($oldtable, $newtable, $drop = FALSE, $data = FALSE)
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLprefix is undeclared
                                  Open

                                      define('MPREFIX', $mySQLprefix);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLuser is undeclared
                                  Open

                                      $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLdefaultdb is undeclared
                                  Open

                                      $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

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

                                              return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

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

                                  Returning type null but retrieve() is declared to return array|string
                                  Open

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

                                  Checking instanceof against undeclared class \mysqli_result
                                  Open

                                          if (!($result instanceof mysqli_result))
                                  Severity: Critical
                                  Found in e107_handlers/mysql_class.php by phan

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

                                                  return FALSE;
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Variable $mySQLserver is undeclared
                                  Open

                                      $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Returning type null but retrieve() is declared to return array|string
                                  Open

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

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  Open

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

                                  Variable $mySQLprefix is undeclared
                                  Open

                                      $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Argument 2 (rli) is null but \e_db_mysql::db_Query() takes \mysqli defined at /code/e107_handlers/mysql_class.php:384
                                  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/mysql_class.php by phan

                                  Assigning array|null to property but \e_db_mysql->mySQLrows is int
                                  Open

                                              $rows = $this->mySQLrows = @mysqli_fetch_array($this->mySQLresult);
                                  Severity: Minor
                                  Found in e107_handlers/mysql_class.php by phan

                                  Saw possibly unextractable annotation for a fragment of comment '* @param string MySQL charset may be forced in special circumstances': after string, did not see an element name (will guess based on comment order)
                                  Open

                                       * @param string    MySQL charset may be forced in special circumstances
                                  Severity: Info
                                  Found in e107_handlers/mysql_class.php by phan

                                  There are no issues that match your filters.

                                  Category
                                  Status