Issues (1704)

Branch: master

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.

Bundle/BlogBundle/Entity/Blog.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
namespace Victoire\Bundle\BlogBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Victoire\Bundle\PageBundle\Entity\Page;
8
9
/**
10
 * PostPage.
11
 *
12
 * @ORM\Entity(repositoryClass="Victoire\Bundle\BlogBundle\Repository\BlogRepository"))
13
 * @ORM\Table("vic_blog")
14
 */
15
class Blog extends Page
16
{
17
    const TYPE = 'blog';
18
19
    /**
20
     * @var ArrayCollection
21
     * @ORM\OneToMany(targetEntity="Category", mappedBy="blog", cascade={"persist", "remove"}, orphanRemoval=true)
22
     */
23
    protected $categories;
24
25
    /**
26
     * @var ArrayCollection
27
     * @ORM\OneToMany(targetEntity="\Victoire\Bundle\BlogBundle\Entity\Article", mappedBy="blog")
28
     */
29
    protected $articles;
30
31
    /**
32
     * @var ArrayCollection
33
     * @ORM\OneToMany(targetEntity="\Victoire\Bundle\BlogBundle\Entity\Tag", mappedBy="blog")
34
     */
35
    protected $tags;
36
37
    /**
38
     * Constructor.
39
     */
40
    public function __construct()
41
    {
42
        $this->categories = new ArrayCollection();
43
        $this->articles = new ArrayCollection();
44
        $this->tags = new ArrayCollection();
45
    }
46
47
    /**
48
     * Get available locales for Articles from this Blog.
49
     *
50
     * @return array
51
     */
52
    public function getAvailableLocales()
53
    {
54
        $availableLocales = [];
55
        $translations = $this->getTranslations();
56
        foreach ($translations as $translation) {
57
            $availableLocales[] = $translation->getLocale();
58
        }
59
60
        return $availableLocales;
61
    }
62
63
    /**
64
     * @return ArrayCollection
65
     */
66
    public function getArticles()
67
    {
68
        return $this->articles;
69
    }
70
71
    /**
0 ignored issues
show
Doc comment for parameter "$articles" missing
Loading history...
72
     * @param $articles
0 ignored issues
show
Missing parameter name
Loading history...
73
     *
74
     * @return $this
75
     */
76
    public function setArticles($articles)
77
    {
78
        $this->articles = $articles;
79
80
        return $this;
81
    }
82
83
    /**
84
     * @param Article $article
85
     *
86
     * @return $this
87
     */
88
    public function addArticle(Article $article)
89
    {
90
        $article->setBlog($this);
91
        $this->articles->add($article);
92
93
        return $this;
94
    }
95
96
    /**
97
     * Set categories.
98
     *
99
     * @param array $categories
100
     *
101
     * @return Blog
102
     */
103
    public function setCategories($categories)
104
    {
105
        foreach ($categories as $category) {
106
            $category->setBlog($this);
107
        }
108
        $this->categories = $categories;
0 ignored issues
show
Documentation Bug introduced by
It seems like $categories of type array is incompatible with the declared type object<Doctrine\Common\C...ctions\ArrayCollection> of property $categories.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
109
110
        return $this;
111
    }
112
113
    /**
114
     * @param Category $category
115
     *
116
     * @return $this
117
     */
118
    public function addCategorie(Category $category)
119
    {
120
        $category->setBlog($this);
121
        $this->categories->add($category);
122
123
        return $this;
124
    }
125
126
    /**
127
     * Remove category.
128
     *
129
     * @param string $category
130
     *
131
     * @return Blog
132
     */
133
    public function removeCategorie($category)
134
    {
135
        $this->categories->removeElement($category);
136
137
        return $this;
138
    }
139
140
    /**
141
     * Get categories.
142
     *
143
     * @return string
144
     */
145
    public function getCategories()
146
    {
147
        return $this->categories;
148
    }
149
150
    /**
151
     * Get root categories.
152
     *
153
     * @return string
154
     */
155
    public function getRootCategories()
156
    {
157
        $rootCategories = [];
158
        foreach ($this->categories as $categories) {
159
            if ($categories->getLvl() == 0) {
160
                $rootCategories[] = $categories;
161
            }
162
        }
163
164
        return $rootCategories;
165
    }
166
167
    /**
168
     * @param Category $rootCategory
169
     *
170
     * @return $this
171
     */
172
    public function addRootCategory(Category $rootCategory)
173
    {
174
        $rootCategory->setBlog($this);
175
        $this->categories->add($rootCategory);
176
177
        return $this;
178
    }
179
180
    /**
181
     * Remove rootCategory.
182
     *
183
     * @param string $rootCategory
184
     *
185
     * @return Blog
186
     */
187
    public function removeRootCategory($rootCategory)
188
    {
189
        $this->categories->removeElement($rootCategory);
190
191
        return $this;
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getTags()
198
    {
199
        return $this->tags;
200
    }
201
202
    /**
203
     * @param string $tags
204
     */
205
    public function setTags($tags)
206
    {
207
        $this->tags = $tags;
0 ignored issues
show
Documentation Bug introduced by
It seems like $tags of type string is incompatible with the declared type object<Doctrine\Common\C...ctions\ArrayCollection> of property $tags.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
208
    }
209
210
    /**
211
     * @param Tag $tag
212
     *
213
     * @return Tag
214
     */
215
    public function addTag(Tag $tag)
216
    {
217
        $tag->setBlog($this);
218
        $this->tags->add($tag);
219
220
        return $tag;
221
    }
222
}
223