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 | * This file is part of Gitamin. |
||
5 | * |
||
6 | * Copyright (C) 2015-2016 The Gitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Gitamin\Http\Controllers; |
||
13 | |||
14 | use Gitamin\Facades\Setting; |
||
15 | use Gitamin\Models\Issue; |
||
16 | use Gitamin\Models\Owner; |
||
17 | use GrahamCampbell\Markdown\Facades\Markdown; |
||
18 | use Illuminate\Support\Str; |
||
19 | use Roumen\Feed\Facades\Feed; |
||
20 | |||
21 | class FeedController extends Controller |
||
22 | { |
||
23 | /** |
||
24 | * Feed facade. |
||
25 | * |
||
26 | * @var \Roumen\Feed\Facades\Feed |
||
27 | */ |
||
28 | protected $feed; |
||
29 | |||
30 | /** |
||
31 | * Create a new feed controller instance. |
||
32 | */ |
||
33 | public function __construct() |
||
34 | { |
||
35 | $this->feed = Feed::make(); |
||
36 | $this->feed->title = Setting::get('app_name'); |
||
37 | $this->feed->description = trans('gitamin.feed'); |
||
38 | $this->feed->link = Str::canonicalize(Setting::get('app_domain')); |
||
39 | $this->feed->setDateFormat('datetime'); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Generates an Atom feed of all issues. |
||
44 | * |
||
45 | * @param \Gitamin\Models\Owner|null $owner |
||
46 | * |
||
47 | * @return \Illuminate\Http\Response |
||
48 | */ |
||
49 | public function atomAction(Owner $owner = null) |
||
50 | { |
||
51 | return $this->feedAction($owner, false); |
||
0 ignored issues
–
show
|
|||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Generates a Rss feed of all issues. |
||
56 | * |
||
57 | * @param \Gitamin\Models\Owner|null $owner |
||
58 | * |
||
59 | * @return \Illuminate\Http\Response |
||
60 | */ |
||
61 | public function rssAction(Owner $owner = null) |
||
62 | { |
||
63 | $this->feed->lang = Setting::get('app_locale'); |
||
0 ignored issues
–
show
The property
lang does not seem to exist in Roumen\Feed\Facades\Feed .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
64 | |||
65 | return $this->feedAction($owner, true); |
||
0 ignored issues
–
show
It seems like
$owner defined by parameter $owner on line 61 can be null ; however, Gitamin\Http\Controllers...ontroller::feedAction() does not accept null , maybe add an additional type check?
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null. We recommend to add an additional type check (or disallow null for the parameter): function notNullable(stdClass $x) { }
// Unsafe
function withoutCheck(stdClass $x = null) {
notNullable($x);
}
// Safe - Alternative 1: Adding Additional Type-Check
function withCheck(stdClass $x = null) {
if ($x instanceof stdClass) {
notNullable($x);
}
}
// Safe - Alternative 2: Changing Parameter
function withNonNullableParam(stdClass $x) {
notNullable($x);
}
![]() |
|||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Generates a feed of all issues. |
||
70 | * |
||
71 | * @param \Gitamin\Models\Owner|null $owner |
||
72 | * @param bool $isRss |
||
73 | * |
||
74 | * @return \Illuminate\Http\Response |
||
75 | */ |
||
76 | private function feedAction(Owner &$owner, $isRss) |
||
77 | { |
||
78 | if ($owner->exists) { |
||
79 | $owner->projects->map(function ($project) { |
||
0 ignored issues
–
show
The property
projects does not exist on object<Gitamin\Models\Owner> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
80 | $project->issues()->visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) use ($isRss) { |
||
0 ignored issues
–
show
|
|||
81 | $this->feedAddItem($issue, $isRss); |
||
82 | }); |
||
83 | }); |
||
84 | } else { |
||
85 | Issue::visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) use ($isRss) { |
||
0 ignored issues
–
show
|
|||
86 | $this->feedAddItem($issue, $isRss); |
||
87 | }); |
||
88 | } |
||
89 | |||
90 | return $this->feed->render($isRss ? 'rss' : 'atom'); |
||
0 ignored issues
–
show
The method
render() does not seem to exist on object<Roumen\Feed\Facades\Feed> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Adds an item to the feed. |
||
95 | * |
||
96 | * @param \Gitamin\Models\Issue $issue |
||
97 | * @param bool $isRss |
||
98 | */ |
||
99 | private function feedAddItem($issue, $isRss) |
||
100 | { |
||
101 | $this->feed->add( |
||
0 ignored issues
–
show
The method
add() does not seem to exist on object<Roumen\Feed\Facades\Feed> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
102 | $issue->name, |
||
0 ignored issues
–
show
The property
name does not exist on object<Gitamin\Models\Issue> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
103 | Setting::get('app_name'), |
||
104 | Str::canonicalize($issue->url), |
||
0 ignored issues
–
show
The property
url does not exist on object<Gitamin\Models\Issue> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
105 | $isRss ? $issue->created_at->toRssString() : $issue->created_at->toAtomString(), |
||
0 ignored issues
–
show
The property
created_at does not exist on object<Gitamin\Models\Issue> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
106 | $isRss ? $issue->message : Markdown::convertToHtml($issue->message) |
||
0 ignored issues
–
show
The property
message does not exist on object<Gitamin\Models\Issue> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
107 | ); |
||
108 | } |
||
109 | } |
||
110 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):