Issues (2687)

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.

src/Eccube/Form/Type/Admin/ProductClassType.php (6 issues)

Symfony2.Arrays.MultiLineArrayComma.Invalid

Unknown

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
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
25
namespace Eccube\Form\Type\Admin;
26
27
use Eccube\Form\DataTransformer;
28
use Symfony\Component\Form\AbstractType;
29
use Symfony\Component\Form\Extension\Core\Type;
30
use Symfony\Component\Form\FormBuilderInterface;
31
use Symfony\Component\Form\FormError;
32
use Symfony\Component\Form\FormEvents;
33
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
34
use Symfony\Component\Validator\Constraints as Assert;
35
36
class ProductClassType extends AbstractType
37
{
38
    public $app;
39
40 663
    public function __construct(\Silex\Application $app)
41
    {
42 663
        $this->app = $app;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 47
    public function buildForm(FormBuilderInterface $builder, array $options)
49
    {
50 47
        $app = $this->app;
51
52
        $builder
53 47
            ->add('code', 'text', array(
54 47
                'label' => '商品コード',
55
                'required' => false,
56
            ))
57 47
            ->add('stock', 'number', array(
58 47
                'label' => '在庫数',
59
                'required' => false,
60
                'constraints' => array(
61 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
62 47
                        'pattern' => "/^\d+$/u",
63
                        'message' => 'form.type.numeric.invalid'
64
                    )),
65
                ),
66
            ))
67 47
            ->add('sale_limit', 'number', array(
68 47
                'label' => '販売制限数',
69
                'required' => false,
70
                'constraints' => array(
71 47
                    new Assert\Length(array(
72 47
                        'max' => 10,
73
                    )),
74 47
                    new Assert\GreaterThanOrEqual(array(
75 47
                        'value' => 1,
76
                    )),
77 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
78 47
                        'pattern' => "/^\d+$/u",
79
                        'message' => 'form.type.numeric.invalid'
80
                    )),
81
                ),
82
            ))
83 47
            ->add('price01', 'money', array(
84 47
                'label' => '通常価格',
85 47
                'currency' => 'JPY',
86 47
                'precision' => 0,
87 47
                'scale' => 0,
88
                'grouping' => true,
89
                'required' => false,
90
                'constraints' => array(
91 47
                    new Assert\Length(array(
92 47
                        'max' => 10,
93
                    )),
94 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
95 47
                        'pattern' => "/^\d+$/u",
96
                        'message' => 'form.type.numeric.invalid'
97
                    )),
98
                ),
99
            ))
100 47
            ->add('price02', 'money', array(
101 47
                'label' => '販売価格',
102 47
                'currency' => 'JPY',
103 47
                'precision' => 0,
104 47
                'scale' => 0,
105
                'grouping' => true,
106
                'constraints' => array(
107 47
                    new Assert\NotBlank(),
108 47
                    new Assert\Length(array(
109 47
                        'max' => 10,
110
                    )),
111 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
112 47
                        'pattern' => "/^\d+$/u",
113
                        'message' => 'form.type.numeric.invalid'
114
                    )),
115
                ),
116
            ))
117 47
            ->add('tax_rate', 'text', array(
118 47
                'label' => '消費税率',
119
                'required' => false,
120
                'constraints' => array(
121 47
                    new Assert\Range(array('min' => 0, 'max' => 100)),
122 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
123 47
                        'pattern' => "/^\d+(\.\d+)?$/",
124
                        'message' => 'form.type.float.invalid'
125
                    )),
126
                ),
127
            ))
128 47
            ->add('delivery_fee', 'money', array(
129 47
                'label' => '商品送料',
130 47
                'currency' => 'JPY',
131 47
                'precision' => 0,
132 47
                'scale' => 0,
133
                'grouping' => true,
134
                'required' => false,
135
                'constraints' => array(
136 47
                    new Assert\Regex(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
137 47
                        'pattern' => "/^\d+$/u",
138
                        'message' => 'form.type.numeric.invalid'
139
                    )),
140
                ),
141
            ))
142 47
            ->add('product_type', 'product_type', array(
143 47
                'label' => '商品種別',
144
                'multiple' => false,
145
                'expanded' => false,
146
                'constraints' => array(
147 47
                    new Assert\NotBlank(),
148
                ),
149
            ))
150 47
            ->add('delivery_date', 'delivery_date', array(
151 47
                'label' => 'お届け可能日',
152
                'required' => false,
153
                'empty_value' => '指定なし',
154
            ))
155 47
            ->add('add', 'checkbox', array(
156 47
                'label' => false,
157
                'required' => false,
158
                'value' => 1,
159
            ))
160 47
            ->addEventListener(FormEvents::POST_SUBMIT, function ($event) {
161 42
                $form = $event->getForm();
162 42
                $data = $form->getData();
163
164 42
                if (empty($data['stock_unlimited']) && is_null($data['stock'])) {
165 1
                    $form['stock_unlimited']->addError(new FormError('在庫数を入力、もしくは在庫無制限を設定してください。'));
166
                }
167 47
            });
168
169 47
        $transformer = new DataTransformer\IntegerToBooleanTransformer();
170
171
        $builder
172 47
            ->add($builder->create('stock_unlimited', 'checkbox', array(
173 47
                'label' => '無制限',
174
                'value' => '1',
175
                'required' => false,
176 47
            ))->addModelTransformer($transformer));
177
178
179 47
        $transformer = new DataTransformer\EntityToIdTransformer(
180 47
            $app['orm.em'],
181 47
            '\Eccube\Entity\ClassCategory'
182
        );
183
        $builder
184 47
            ->add($builder->create('ClassCategory1', 'hidden')
185 47
                ->addModelTransformer($transformer)
186
            )
187 47
            ->add($builder->create('ClassCategory2', 'hidden')
188 47
                ->addModelTransformer($transformer)
189
            );
190
    }
191
192
    /**
193
     * {@inheritdoc}
194
     */
195 47
    public function setDefaultOptions(OptionsResolverInterface $resolver)
196
    {
197 47
        $resolver->setDefaults(array(
198 47
            'data_class' => 'Eccube\Entity\ProductClass',
199
        ));
200
    }
201
202
    /**
203
     * {@inheritdoc}
204
     */
205 663
    public function getName()
206
    {
207 663
        return 'admin_product_class';
208
    }
209
}
210