__get accesses the super-global variable $_SESSION. Open
public function __get($key)
{
$realKey = $this->name . '-' . $key;
return isset($_SESSION[$realKey]) ? $_SESSION[$realKey] : '';
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__isset accesses the super-global variable $_SESSION. Open
public function __isset($key)
{
$realKey = $this->name . '-' . $key;
return isset($_SESSION[$realKey]);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__unset accesses the super-global variable $_SESSION. Open
public function __unset($key)
{
$realKey = $this->name . '-' . $key;
unset($_SESSION[$realKey]);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__get accesses the super-global variable $_SESSION. Open
public function __get($key)
{
$realKey = $this->name . '-' . $key;
return isset($_SESSION[$realKey]) ? $_SESSION[$realKey] : '';
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__set accesses the super-global variable $_SESSION. Open
public function __set($key, $val)
{
$realKey = $this->name . '-' . $key;
$_SESSION[$realKey] = $val;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Remove error control operator '@' on line 20. Open
public function __construct($name)
{
// security is not the goal here.
// hashing just serves to normalize length.
$this->name = sha1($name);
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}