Issues (1191)

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.

src/Entry/EntryObserver.php (8 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 namespace Anomaly\Streams\Platform\Entry;
2
3
use Anomaly\Streams\Platform\Entry\Command\DeleteEntryTranslations;
4
use Anomaly\Streams\Platform\Entry\Command\SetMetaInformation;
5
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
6
use Anomaly\Streams\Platform\Entry\Event\EntryWasCreated;
7
use Anomaly\Streams\Platform\Entry\Event\EntryWasDeleted;
8
use Anomaly\Streams\Platform\Entry\Event\EntryWasRestored;
9
use Anomaly\Streams\Platform\Entry\Event\EntryWasSaved;
10
use Anomaly\Streams\Platform\Entry\Event\EntryWasUpdated;
11
use Anomaly\Streams\Platform\Model\Command\CascadeDelete;
12
use Anomaly\Streams\Platform\Model\Command\CascadeRestore;
13
use Anomaly\Streams\Platform\Model\EloquentModel;
14
use Anomaly\Streams\Platform\Model\Event\ModelsWereDeleted;
15
use Anomaly\Streams\Platform\Model\Event\ModelsWereUpdated;
16
use Anomaly\Streams\Platform\Support\Observer;
17
18
/**
19
 * Class EntryObserver
20
 *
21
 * @link    http://pyrocms.com/
22
 * @author  PyroCMS, Inc. <[email protected]>
23
 * @author  Ryan Thompson <[email protected]>
24
 *
25
 */
26
class EntryObserver extends Observer
27
{
28
29
    /**
30
     * Run before a record is created.
31
     *
32
     * @param EntryInterface $entry
33
     */
34
    public function creating(EntryInterface $entry)
35
    {
36
        $entry->fireFieldTypeEvents('entry_creating');
37
    }
38
39
    /**
40
     * Run after a record is created.
41
     *
42
     * @param EntryInterface $entry
43
     */
44
    public function created(EntryInterface $entry)
45
    {
46
        $entry->fireFieldTypeEvents('entry_created');
47
48
        $this->events->fire(new EntryWasCreated($entry));
49
    }
50
51
    /**
52
     * Run before a record is updated.
53
     *
54
     * @param EntryInterface $entry
55
     */
56
    public function updating(EntryInterface $entry)
0 ignored issues
show
The parameter $entry is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
    {
58
        //
59
    }
60
61
    /**
62
     * Run after a record is updated.
63
     *
64
     * @param EntryInterface $entry
65
     */
66
    public function updated(EntryInterface $entry)
67
    {
68
        $entry->fireFieldTypeEvents('entry_updated');
69
70
        $this->events->fire(new EntryWasUpdated($entry));
71
    }
72
73
    /**
74
     * Run after multiple entries have been updated.
75
     *
76
     * @param EntryInterface $entry
77
     */
78
    public function updatedMultiple(EntryInterface $entry)
79
    {
80
        $entry->flushCache();
81
82
        $this->events->fire(new ModelsWereUpdated($entry));
0 ignored issues
show
$entry is of type object<Anomaly\Streams\P...ontract\EntryInterface>, but the function expects a object<Anomaly\Streams\P...rm\Model\EloquentModel>.

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);
Loading history...
83
    }
84
85
    /**
86
     * Before saving an entry touch the
87
     * meta information.
88
     *
89
     * @param  EntryInterface $entry
90
     * @return bool
91
     */
92
    public function saving(EntryInterface $entry)
93
    {
94
        //$entry->fireFieldTypeEvents('entry_saving');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
95
96
        $this->commands->dispatch(new SetMetaInformation($entry));
0 ignored issues
show
$entry is of type object<Anomaly\Streams\P...ontract\EntryInterface>, but the function expects a object<Anomaly\Streams\P...rm\Model\EloquentModel>.

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);
Loading history...
97
98
        return true;
99
    }
100
101
    /**
102
     * Run after saving a record.
103
     *
104
     * @param EntryInterface $entry
105
     */
106
    public function saved(EntryInterface $entry)
107
    {
108
        $entry->flushCache();
109
        $entry->fireFieldTypeEvents('entry_saved');
110
111
        $this->events->fire(new EntryWasSaved($entry));
112
    }
113
114
    /**
115
     * Run before a record is deleted.
116
     *
117
     * @param  EntryInterface|EloquentModel $entry
118
     * @return bool
119
     */
120
    public function deleting(EntryInterface $entry)
121
    {
122
        $this->dispatch(new CascadeDelete($entry));
0 ignored issues
show
$entry is of type object<Anomaly\Streams\P...ontract\EntryInterface>, but the function expects a object<Anomaly\Streams\P...rm\Model\EloquentModel>.

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);
Loading history...
123
124
        return true;
125
    }
126
127
    /**
128
     * Run after a record has been deleted.
129
     *
130
     * @param EntryInterface $entry
131
     */
132
    public function deleted(EntryInterface $entry)
133
    {
134
        $entry->flushCache();
135
        $entry->fireFieldTypeEvents('entry_deleted');
136
137
        $this->commands->dispatch(new DeleteEntryTranslations($entry));
138
139
        $this->events->fire(new EntryWasDeleted($entry));
140
    }
141
142
    /**
143
     * Run after entries records have been deleted.
144
     *
145
     * @param EntryInterface $entry
146
     */
147
    public function deletedMultiple(EntryInterface $entry)
148
    {
149
        $entry->flushCache();
150
151
        $this->events->fire(new ModelsWereDeleted($entry));
0 ignored issues
show
$entry is of type object<Anomaly\Streams\P...ontract\EntryInterface>, but the function expects a object<Anomaly\Streams\P...rm\Model\EloquentModel>.

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);
Loading history...
152
    }
153
154
    /**
155
     * Fired just before restoring.
156
     *
157
     * @param EntryInterface|EloquentModel $entry
158
     */
159
    public function restoring(EntryInterface $entry)
0 ignored issues
show
The parameter $entry is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
160
    {
161
        //
162
    }
163
164
    /**
165
     * Run after a record has been restored.
166
     *
167
     * @param EntryInterface|EloquentModel $entry
168
     */
169
    public function restored(EntryInterface $entry)
170
    {
171
        $entry->flushCache();
172
        $entry->fireFieldTypeEvents('entry_restored');
173
174
        $this->dispatch(new CascadeRestore($entry));
0 ignored issues
show
$entry is of type object<Anomaly\Streams\P...ontract\EntryInterface>, but the function expects a object<Anomaly\Streams\P...rm\Model\EloquentModel>.

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);
Loading history...
175
176
        $this->events->fire(new EntryWasRestored($entry));
177
    }
178
}
179