GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (1410)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

protected/controllers/BasketController.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package frontend.controllers
8
 */
9
class BasketController extends FController
10
{
11
  private $renderPanel = false;
12
13
  public function filter()
14
  {
15
    return array('ajaxOnly + ajax, fastOrder, favoriteToBasket, repeatOrder');
16
  }
17
18
  public function actionAjax()
19
  {
20
    $this->processBasketAction();
21
    $this->renderAjax();
22
  }
23
24
  public function actionFastOrder()
25
  {
26
    $form = $this->fastOrderForm;
27
    $form->ajaxValidation();
28
29
    $fastOrderBasket = new FBasket('fastOrderBasket', array(), false);
30
    $fastOrderBasket->add(Yii::app()->request->getPost($this->basket->keyCollection));
31
    $form->model->setFastOrderBasket($fastOrderBasket);
32
33
    if( !$fastOrderBasket->isEmpty() && $form->save() )
34
    {
35
      Yii::app()->notification->send('FastOrderBackend', array('model' => $form->model), null, 'backend');
36
      Yii::app()->notification->send('FastOrder', array('model' => $form->model), $form->model->email);
37
38
      echo CJSON::encode(array(
39
        'status' => 'ok',
40
        'hideElements' => array($form->id),
41
        'showElements' => array($this->basket->fastOrderFormSuccessId)
42
      ));
43
      Yii::app()->end();
0 ignored issues
show
The method end does only exist in BTestApplication and FTestApplication, but not in BApplication and FApplication.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
44
    }
45
  }
46
47
  public function actionRepeatOrder()
48
  {
49
    $data = Yii::app()->request->getPost($this->basket->keyCollection);
50
    $orderId = Arr::get($data, 'order-id');
51
52
    try
53
    {
54
      /**
55
       * @var OrderHistory $order
56
       */
57
      if( $order = OrderHistory::model()->findByPk($orderId) )
58
      {
59
        foreach($order->products as $orderProduct)
60
        {
61
          $data = array(
62
            'type' => 'product',
63
            'id' => $orderProduct->history->product_id,
64
            'amount' => $orderProduct->count,
65
            'items' => array()
66
          );
67
68
          if( $options = $orderProduct->getItems('ProductOption') )
69
          {
70
            foreach($options as $option)
71
            {
72
              $data['items']['options'][] = array('id' => $option->pk, 'type' => $option->type);
73
            }
74
          }
75
76
          if( $ingredients = $orderProduct->getItems('ProductIngredientAssignment') )
77
          {
78
            foreach($ingredients as $ingredient)
79
            {
80
              $data['items']['ingredients'][] = array(
81
                'id' => $ingredient->pk,
82
                'type' => $ingredient->type,
83
                'amount' => $ingredient->amount
84
              );
85
            }
86
          }
87
          $this->basket->add($data);
88
        }
89
90
        $this->renderAjax();
91
      }
92
    }
93
    catch(CHttpException $e)
0 ignored issues
show
The class CHttpException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
94
    {
95
      $e->handled = true;
96
      throw new CHttpException(500, 'Ошибка. Невозможно выполнить повтрный заказ');
97
    }
98
  }
99
100
  protected function processBasketAction()
101
  {
102
    $request = Yii::app()->request;
103
    $data = $request->getPost($this->basket->keyCollection);
104
    $action = $request->getPost('action');
105
106
    if( $data && $action )
107
    {
108
      switch($action)
109
      {
110 View Code Duplication
        case 'remove':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
111
          $index = Arr::get($data, 'index');
112
113
          if( is_null($index) )
114
            $index = $this->basket->getIndex($data);
115
116
          if( is_null($index) || !$this->basket->exists($index) )
117
            throw new CHttpException(500, 'Данный продукт уже удален. Обновите страницу.');
118
119
          $this->basket->remove($index);
120
        break;
121
122
        case 'changeAmount':
123
          if( !$this->basket->exists($data['index']) )
124
            throw new CHttpException(500, 'Продукт не найден. Обновите страницу.');
125
          $amount = intval($data['amount']);
126
          $this->basket->changeAmount($data['index'], $amount > 0 ? $amount : 1);
127
        break;
128
129
        case 'changeItems':
130
          if( !$this->basket->exists($data['index']) )
131
            throw new CHttpException(500, 'Продукт не найден. Обновите страницу.');
132
133
          $items = Arr::get($this->basket[$data['index']]->getCollectionElement()->toArray(), 'items', array());
0 ignored issues
show
$items is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
134
          $items = $data;
135
          $this->basket->changeItems($data['index'], $items);
136
        break;
137
138
        case 'add':
139
          $this->basket->add($data);
140
        break;
141
      }
142
    }
143
  }
144
145
  protected function renderAjax()
146
  {
147
    $this->renderPartial('/_basket_header');
148
    $this->renderPanel();
149
  }
150
151
  private function renderPanel()
152
  {
153
    if( $this->renderPanel )
154
      $this->renderPartial('/panel/panel');
155
  }
156
}