Issues (41)

Security Analysis    no request data  

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/Component/TimezoneRule.php (2 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
2
3
/*
4
 * This file is part of the eluceo/iCal package.
5
 *
6
 * (c) Markus Poerschke <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Eluceo\iCal\Component;
13
14
use Eluceo\iCal\Component;
15
use Eluceo\iCal\Property\Event\RecurrenceRule;
16
use Eluceo\iCal\PropertyBag;
17
18
/**
19
 * Implementation of Standard Time and Daylight Saving Time observances (or rules)
20
 * which define the TIMEZONE component.
21
 */
22
class TimezoneRule extends Component
23
{
24
    const TYPE_DAYLIGHT = 'DAYLIGHT';
25
    const TYPE_STANDARD = 'STANDARD';
26
27
    /**
28
     * @var string
29
     */
30
    protected $type;
31
32
    /**
33
     * @var string
34
     */
35
    protected $tzOffsetFrom;
36
37
    /**
38
     * @var string
39
     */
40
    protected $tzOffsetTo;
41
42
    /**
43
     * @var string
44
     */
45
    protected $tzName;
46
47
    /**
48
     * @var \DateTimeInterface
49
     */
50
    protected $dtStart;
51
52
    /**
53
     * @var RecurrenceRule
54
     */
55
    protected $recurrenceRule;
56
57
    /**
58
     * create new Timezone Rule object by giving a rule type identifier.
59
     *
60
     * @param string $ruleType one of DAYLIGHT or STANDARD
61
     *
62
     * @throws \InvalidArgumentException
63
     */
64 View Code Duplication
    public function __construct($ruleType)
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.

Loading history...
65
    {
66
        $ruleType = strtoupper($ruleType);
67
        if ($ruleType === self::TYPE_DAYLIGHT || $ruleType === self::TYPE_STANDARD) {
68
            $this->type = $ruleType;
69
        } else {
70
            throw new \InvalidArgumentException('Invalid value for timezone rule type');
71
        }
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function buildPropertyBag()
78
    {
79
        $propertyBag = new PropertyBag();
80
81
        if ($this->getTzName()) {
82
            $propertyBag->set('TZNAME', $this->getTzName());
83
        }
84
85
        if ($this->getTzOffsetFrom()) {
86
            $propertyBag->set('TZOFFSETFROM', $this->getTzOffsetFrom());
87
        }
88
89
        if ($this->getTzOffsetTo()) {
90
            $propertyBag->set('TZOFFSETTO', $this->getTzOffsetTo());
91
        }
92
93
        if ($this->getDtStart()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->getDtStart() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
94
            $propertyBag->set('DTSTART', $this->getDtStart());
95
        }
96
97
        if ($this->recurrenceRule) {
98
            $propertyBag->set('RRULE', $this->recurrenceRule);
99
        }
100
101
        return $propertyBag;
102
    }
103
104
    /**
105
     * @param $offset
106
     *
107
     * @return $this
108
     */
109
    public function setTzOffsetFrom($offset)
110
    {
111
        $this->tzOffsetFrom = $offset;
112
113
        return $this;
114
    }
115
116
    /**
117
     * @param $offset
118
     *
119
     * @return $this
120
     */
121
    public function setTzOffsetTo($offset)
122
    {
123
        $this->tzOffsetTo = $offset;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @param $name
130
     *
131
     * @return $this
132
     */
133
    public function setTzName($name)
134
    {
135
        $this->tzName = $name;
136
137
        return $this;
138
    }
139
140
    /**
141
     * @return $this
142
     */
143
    public function setDtStart(\DateTimeInterface $dtStart)
144
    {
145
        $this->dtStart = $dtStart;
146
147
        return $this;
148
    }
149
150
    /**
151
     * @return $this
152
     */
153
    public function setRecurrenceRule(RecurrenceRule $recurrenceRule)
154
    {
155
        $this->recurrenceRule = $recurrenceRule;
156
157
        return $this;
158
    }
159
160
    /**
161
     * {@inheritdoc}
162
     */
163
    public function getType()
164
    {
165
        return $this->type;
166
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getTzOffsetFrom()
172
    {
173
        return $this->tzOffsetFrom;
174
    }
175
176
    /**
177
     * @return string
178
     */
179
    public function getTzOffsetTo()
180
    {
181
        return $this->tzOffsetTo;
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getTzName()
188
    {
189
        return $this->tzName;
190
    }
191
192
    /**
193
     * @return RecurrenceRule
194
     */
195
    public function getRecurrenceRule()
196
    {
197
        return $this->recurrenceRule;
198
    }
199
200
    /**
201
     * @return mixed return string representation of start date or NULL if no date was given
202
     */
203
    public function getDtStart()
204
    {
205
        if ($this->dtStart) {
206
            return $this->dtStart->format('Ymd\THis');
207
        }
208
209
        return;
210
    }
211
}
212