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 | class ChildPaginatorControllerExtension extends Extension |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | /* |
||
6 | Call this from a template to iterate through a number of items (default 10) for the |
||
7 | currently selected page. The result is saved as a variable called $this->lastPagedResults for |
||
8 | caching purposes when it comes to rendering the pagination |
||
9 | |||
10 | <code> |
||
11 | <% control PagedChildren(NewsItem,8) %> |
||
12 | <li> |
||
13 | <a href="$Link">$Title</a> |
||
14 | <br/> |
||
15 | <a href="$Link">$NewsItemImage.SetWidth(200)</a> |
||
16 | <br/> |
||
17 | <a href="$Link">$NewsItemDate.Nice</a> |
||
18 | |||
19 | </li> |
||
20 | <% end_control %> |
||
21 | </code> |
||
22 | */ |
||
23 | View Code Duplication | public function PagedChildren($klazz, $pageLength = 10, $prime = false, $relationship_key = 'ParentID') |
|
0 ignored issues
–
show
This method seems to be duplicated in 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. ![]() |
|||
24 | { |
||
25 | $parentID = $this->owner->ID; |
||
26 | $req = Controller::curr()->getRequest(); |
||
27 | $list = DataList::create($klazz)->where('"ParentID" = '.$parentID); |
||
28 | $this->lastPagedResults = new PaginatedList($list, $req); |
||
0 ignored issues
–
show
The property
lastPagedResults does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
29 | $this->lastPagedResults->setPageLength($pageLength); |
||
30 | $this->lastPagedResults->setLimitItems($pageLength); |
||
0 ignored issues
–
show
$pageLength is of type integer , but the function expects a boolean .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
31 | $result = $this->lastPagedResults; |
||
32 | if ($prime == true) { |
||
0 ignored issues
–
show
|
|||
33 | $result = ''; // render nothing to the template, we are only updating variables |
||
0 ignored issues
–
show
|
|||
34 | } |
||
35 | |||
36 | return $result; |
||
37 | } |
||
38 | |||
39 | View Code Duplication | public function AllPagedChildren($pageLength = 10, $sort = 'Sort', $prime = false, $relationship_key = 'ParentID') |
|
0 ignored issues
–
show
This method seems to be duplicated in 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. ![]() |
|||
40 | { |
||
41 | $parentID = $this->owner->ID; |
||
42 | $req = Controller::curr()->getRequest(); |
||
43 | $list = SiteTree::get()->where('"ParentID" = '.$parentID); |
||
44 | $this->lastPagedResults = new PaginatedList($list, $req); |
||
45 | $this->lastPagedResults->setPageLength($pageLength); |
||
46 | $this->lastPagedResults->setLimitItems($pageLength); |
||
0 ignored issues
–
show
$pageLength is of type integer , but the function expects a boolean .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
47 | $result = $this->lastPagedResults; |
||
48 | if ($prime == true) { |
||
0 ignored issues
–
show
|
|||
49 | $result = ''; // render nothing to the template, we are only updating variables |
||
50 | } |
||
51 | |||
52 | return $result; |
||
53 | } |
||
54 | |||
55 | public function PagedDataObjectsByClassName($klazz, $pageLength = 10, $sort = 'ASC') |
||
0 ignored issues
–
show
|
|||
56 | { |
||
57 | $req = Controller::curr()->getRequest(); |
||
58 | $this->lastPagedResults = new PaginatedList(DataList::create($klazz)->sort('LastEdited '.$sort), $req); |
||
59 | $this->lastPagedResults->setPageLength($pageLength); |
||
60 | $this->lastPagedResults->setLimitItems($pageLength); |
||
0 ignored issues
–
show
$pageLength is of type integer , but the function expects a boolean .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
61 | |||
62 | return $this->lastPagedResults; |
||
63 | } |
||
64 | |||
65 | public function SetPagedOffset($newoffset) |
||
0 ignored issues
–
show
|
|||
66 | { |
||
67 | $this->PagedOffset = $newoffset; |
||
0 ignored issues
–
show
The property
PagedOffset does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
68 | } |
||
69 | |||
70 | public function PagedChildrenAllButFirst() |
||
0 ignored issues
–
show
|
|||
71 | { |
||
72 | } |
||
73 | |||
74 | /* |
||
75 | The current page number. This is only populated after the call to PagedChildren |
||
76 | */ |
||
77 | public function PageNumber() |
||
0 ignored issues
–
show
|
|||
78 | { |
||
79 | return $this->PageNumber; // variable, not the method, populated when loading the pages items |
||
0 ignored issues
–
show
The property
PageNumber does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
80 | } |
||
81 | |||
82 | /* |
||
83 | A cached copy of the pagination results |
||
84 | */ |
||
85 | public function LastPagedResults() |
||
0 ignored issues
–
show
|
|||
86 | { |
||
87 | return $this->lastPagedResults; |
||
88 | } |
||
89 | } |
||
90 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.