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 | |||
4 | /** |
||
5 | * Allows you to group OrderAttributes. |
||
6 | */ |
||
7 | class OrderAttribute_Group extends DataObject implements EditableEcommerceObject |
||
8 | { |
||
9 | private static $db = array( |
||
0 ignored issues
–
show
Comprehensibility
introduced
by
![]() |
|||
10 | 'Name' => 'Varchar', |
||
11 | 'Sort' => 'Int', |
||
12 | ); |
||
13 | |||
14 | /** |
||
15 | * Standard SS variable. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | private static $indexes = array( |
||
0 ignored issues
–
show
|
|||
20 | 'Sort' => true, |
||
21 | ); |
||
22 | |||
23 | |||
24 | /** |
||
25 | * standard SS variable. |
||
26 | * |
||
27 | * @Var String |
||
28 | */ |
||
29 | private static $singular_name = 'Order Modifier Group'; |
||
0 ignored issues
–
show
|
|||
30 | public function i18n_singular_name() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a ![]() |
|||
31 | { |
||
32 | return $this->Config()->get('singular_name'); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * standard SS variable. |
||
37 | * |
||
38 | * @Var String |
||
39 | */ |
||
40 | private static $plural_name = 'Order Modifier Types'; |
||
0 ignored issues
–
show
|
|||
41 | public function i18n_plural_name() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a ![]() |
|||
42 | { |
||
43 | return $this->Config()->get('plural_name'); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Standard SS Method. |
||
48 | * |
||
49 | * @param Member $member |
||
0 ignored issues
–
show
Should the type for parameter
$member not be Member|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
50 | * |
||
51 | * @var bool |
||
52 | */ |
||
53 | public function canCreate($member = null) |
||
54 | { |
||
55 | if (! $member) { |
||
56 | $member = Member::currentUser(); |
||
57 | } |
||
58 | $extended = $this->extendedCan(__FUNCTION__, $member); |
||
0 ignored issues
–
show
$member is of type object<DataObject>|null , but the function expects a object<Member>|integer .
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);
![]() |
|||
59 | if ($extended !== null) { |
||
60 | return $extended; |
||
61 | } |
||
62 | if (Permission::checkMember($member, Config::inst()->get('EcommerceRole', 'admin_permission_code'))) { |
||
63 | return true; |
||
64 | } |
||
65 | |||
66 | return parent::canEdit($member); |
||
0 ignored issues
–
show
It seems like
$member defined by \Member::currentUser() on line 56 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() It seems like you call parent on a different method (
canEdit() instead of canCreate() ). Are you sure this is correct? If so, you might want to change this to $this->canEdit() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Standard SS Method. |
||
71 | * |
||
72 | * @param Member $member |
||
0 ignored issues
–
show
Should the type for parameter
$member not be Member|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
73 | * |
||
74 | * @var bool |
||
75 | */ |
||
76 | public function canView($member = null) |
||
77 | { |
||
78 | if (! $member) { |
||
79 | $member = Member::currentUser(); |
||
80 | } |
||
81 | $extended = $this->extendedCan(__FUNCTION__, $member); |
||
0 ignored issues
–
show
$member is of type object<DataObject>|null , but the function expects a object<Member>|integer .
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);
![]() |
|||
82 | if ($extended !== null) { |
||
83 | return $extended; |
||
84 | } |
||
85 | if (Permission::checkMember($member, Config::inst()->get('EcommerceRole', 'admin_permission_code'))) { |
||
86 | return true; |
||
87 | } |
||
88 | |||
89 | return parent::canEdit($member); |
||
0 ignored issues
–
show
It seems like
$member defined by \Member::currentUser() on line 79 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() It seems like you call parent on a different method (
canEdit() instead of canView() ). Are you sure this is correct? If so, you might want to change this to $this->canEdit() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Standard SS Method. |
||
94 | * |
||
95 | * @param Member $member |
||
0 ignored issues
–
show
Should the type for parameter
$member not be Member|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
96 | * |
||
97 | * @var bool |
||
98 | */ |
||
99 | public function canEdit($member = null) |
||
100 | { |
||
101 | if (! $member) { |
||
102 | $member = Member::currentUser(); |
||
103 | } |
||
104 | $extended = $this->extendedCan(__FUNCTION__, $member); |
||
0 ignored issues
–
show
$member is of type object<DataObject>|null , but the function expects a object<Member>|integer .
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);
![]() |
|||
105 | if ($extended !== null) { |
||
106 | return $extended; |
||
107 | } |
||
108 | if (Permission::checkMember($member, Config::inst()->get('EcommerceRole', 'admin_permission_code'))) { |
||
109 | return true; |
||
110 | } |
||
111 | |||
112 | return parent::canEdit($member); |
||
0 ignored issues
–
show
It seems like
$member defined by \Member::currentUser() on line 102 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() |
|||
113 | } |
||
114 | |||
115 | /** |
||
116 | * Standard SS Method. |
||
117 | * |
||
118 | * @param Member $member |
||
0 ignored issues
–
show
Should the type for parameter
$member not be Member|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
119 | * |
||
120 | * @var bool |
||
121 | */ |
||
122 | public function canDelete($member = null) |
||
123 | { |
||
124 | if (! $member) { |
||
125 | $member = Member::currentUser(); |
||
126 | } |
||
127 | $extended = $this->extendedCan(__FUNCTION__, $member); |
||
0 ignored issues
–
show
$member is of type object<DataObject>|null , but the function expects a object<Member>|integer .
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);
![]() |
|||
128 | if ($extended !== null) { |
||
129 | return $extended; |
||
130 | } |
||
131 | if (Permission::checkMember($member, Config::inst()->get('EcommerceRole', 'admin_permission_code'))) { |
||
132 | return true; |
||
133 | } |
||
134 | |||
135 | return parent::canEdit($member); |
||
0 ignored issues
–
show
It seems like
$member defined by \Member::currentUser() on line 125 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() It seems like you call parent on a different method (
canEdit() instead of canDelete() ). Are you sure this is correct? If so, you might want to change this to $this->canEdit() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
136 | } |
||
137 | |||
138 | /** |
||
139 | * link to edit the record. |
||
140 | * |
||
141 | * @param string | Null $action - e.g. edit |
||
142 | * |
||
143 | * @return string |
||
0 ignored issues
–
show
|
|||
144 | */ |
||
145 | public function CMSEditLink($action = null) |
||
146 | { |
||
147 | return CMSEditLinkAPI::find_edit_link_for_object($this, $action); |
||
148 | } |
||
149 | } |
||
150 |