This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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\PageBundle\Controller; |
||
4 | |||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
||
6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; |
||
7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
||
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
||
9 | use Symfony\Component\HttpFoundation\JsonResponse; |
||
10 | use Symfony\Component\HttpFoundation\Request; |
||
11 | use Victoire\Bundle\PageBundle\Entity\BasePage; |
||
12 | use Victoire\Bundle\PageBundle\Entity\Page; |
||
13 | use Victoire\Bundle\PageBundle\Form\PageSettingsType; |
||
14 | use Victoire\Bundle\PageBundle\Form\PageType; |
||
15 | |||
16 | /** |
||
17 | * Page Controller. |
||
18 | * |
||
19 | * @Route("/victoire-dcms/page") |
||
20 | **/ |
||
21 | class PageController extends BasePageController |
||
22 | { |
||
23 | /** |
||
24 | * Display a form to create a new Page. |
||
25 | * |
||
26 | * @param Request $request |
||
27 | * @param bool $isHomepage Is the page a homepage |
||
28 | * |
||
29 | * @Route("/new", name="victoire_core_page_new", defaults={"isHomepage" : false}) |
||
30 | * @Route("/homepage/new", name="victoire_core_homepage_new", defaults={"isHomepage" : true}) |
||
31 | * @Method("GET") |
||
32 | * @Template() |
||
33 | * |
||
34 | * @return JsonResponse |
||
35 | */ |
||
36 | public function newAction(Request $request, $isHomepage = false) |
||
37 | { |
||
38 | return new JsonResponse(parent::newAction($request, $isHomepage)); |
||
0 ignored issues
–
show
|
|||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Create a new Page. |
||
43 | * |
||
44 | * @param Request $request |
||
45 | * |
||
46 | * @Route("/new", name="victoire_core_page_new_post") |
||
47 | * @Route("/homepage/new", name="victoire_core_homepage_new") |
||
48 | * @Method("POST") |
||
49 | * @Template() |
||
50 | * |
||
51 | * @return JsonResponse |
||
52 | */ |
||
53 | public function newPostAction(Request $request) |
||
54 | { |
||
55 | return new JsonResponse(parent::newPostAction($request)); |
||
0 ignored issues
–
show
The return type of
return new \Symfony\Comp...wPostAction($request)); (Symfony\Component\HttpFoundation\JsonResponse ) is incompatible with the return type of the parent method Victoire\Bundle\PageBund...ntroller::newPostAction of type array .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Display a form to edit Page settings. |
||
60 | * |
||
61 | * @param Request $request |
||
62 | * @param BasePage $page |
||
63 | * |
||
64 | * @Route("/{id}/settings", name="victoire_core_page_settings") |
||
65 | * @Method("GET") |
||
66 | * @Template() |
||
67 | * @ParamConverter("page", class="VictoirePageBundle:BasePage") |
||
68 | * |
||
69 | * @return JsonResponse The settings |
||
70 | */ |
||
71 | public function settingsAction(Request $request, BasePage $page) |
||
72 | { |
||
73 | return new JsonResponse(parent::settingsAction($request, $page)); |
||
0 ignored issues
–
show
The return type of
return new \Symfony\Comp...tion($request, $page)); (Symfony\Component\HttpFoundation\JsonResponse ) is incompatible with the return type of the parent method Victoire\Bundle\PageBund...troller::settingsAction of type array .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Save Page settings. |
||
78 | * |
||
79 | * @param Request $request |
||
80 | * @param BasePage $page |
||
81 | * |
||
82 | * @Route("/{id}/settings", name="victoire_core_page_settings_post") |
||
83 | * @Method("POST") |
||
84 | * @Template() |
||
85 | * @ParamConverter("page", class="VictoirePageBundle:BasePage") |
||
86 | * |
||
87 | * @return JsonResponse The settings |
||
88 | */ |
||
89 | public function settingsPostAction(Request $request, BasePage $page) |
||
90 | { |
||
91 | return new JsonResponse(parent::settingsPostAction($request, $page)); |
||
0 ignored issues
–
show
The return type of
return new \Symfony\Comp...tion($request, $page)); (Symfony\Component\HttpFoundation\JsonResponse ) is incompatible with the return type of the parent method Victoire\Bundle\PageBund...ler::settingsPostAction of type array .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Page delete. |
||
96 | * |
||
97 | * @param BasePage $page |
||
98 | * |
||
99 | * @return JsonResponse |
||
100 | * @Route("/{id}/delete", name="victoire_core_page_delete") |
||
101 | * @Template() |
||
102 | * @ParamConverter("page", class="VictoirePageBundle:BasePage") |
||
103 | */ |
||
104 | public function deleteAction(BasePage $page) |
||
105 | { |
||
106 | return new JsonResponse(parent::deleteAction($page)); |
||
0 ignored issues
–
show
The return type of
return new \Symfony\Comp...::deleteAction($page)); (Symfony\Component\HttpFoundation\JsonResponse ) is incompatible with the return type of the parent method Victoire\Bundle\PageBund...ontroller::deleteAction of type array<string,boolean|string> .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
107 | } |
||
108 | |||
109 | /** |
||
110 | * getNewPageType. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | protected function getNewPageType() |
||
115 | { |
||
116 | return PageType::class; |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * getPageSettingsType. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function getPageSettingsType() |
||
125 | { |
||
126 | return PageSettingsType::class; |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * getBusinessPageType. |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | protected function getBusinessPageType() |
||
135 | { |
||
136 | return PageSettingsType::class; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * getNewPage. |
||
141 | * |
||
142 | * @return \Victoire\Bundle\PageBundle\Entity\Page |
||
143 | */ |
||
144 | protected function getNewPage() |
||
145 | { |
||
146 | return new Page(); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * getBaseTemplatePath. |
||
151 | * |
||
152 | * @return string |
||
153 | */ |
||
154 | protected function getBaseTemplatePath() |
||
155 | { |
||
156 | return 'VictoirePageBundle:Page'; |
||
157 | } |
||
158 | } |
||
159 |
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.
Let’s take a look at an example:
Our function
my_function
expects aPost
object, and outputs the author of the post. The base classPost
returns a simple string and outputting a simple string will work just fine. However, the child classBlogPost
which is a sub-type ofPost
instead decided to return anobject
, and is therefore violating the SOLID principles. If aBlogPost
were passed tomy_function
, PHP would not complain, but ultimately fail when executing thestrtoupper
call in its body.