Skip to content
Snippets Groups Projects
Commit 3ef173d6 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

prevent php8 warning, fixes #2269

Closes #2269

Merge request studip/studip!1496
parent 0c738bf1
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
......@@ -59,7 +59,7 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate
$id = md5($activity->provider . $activity->content .
$activity->verb . $activity->object_type . $activity->mkdate);
if ($new_activities[$id]) {
if (isset($new_activities[$id])) {
$url = key($activity->object_url);
$name = current($activity->object_url);
next($activity->object_url);
......
......@@ -121,7 +121,7 @@ class ForumActivity
'verb' => $verb, // the activity type
'object_id' => $post['topic_id'], // the id of the referenced object
'object_type' => 'forum', // type of activity object
'mkdate' => $post['mkdate'] ?: time()
'mkdate' => $post['mkdate'] ?? time()
];
if ($post['anonymous']) {
......
......@@ -36,7 +36,7 @@ class StudipMail
*/
private $attachments = [];
/**
* @var string
* @var array
*/
private $sender;
/**
......@@ -45,7 +45,7 @@ class StudipMail
*/
private $recipients = [];
/**
* @var string
* @var array
*/
private $reply_to;
......@@ -175,7 +175,7 @@ class StudipMail
*/
public function getReplyToEmail()
{
return $this->reply_to['mail'];
return $this->reply_to['mail'] ?? '';
}
/**
......@@ -193,7 +193,7 @@ class StudipMail
*/
public function getReplyToName()
{
return $this->reply_to['name'];
return $this->reply_to['name'] ?? '';
}
/**
......
......@@ -50,7 +50,7 @@ use Negotiation\AcceptHeader;
function get_accepted_languages(Psr\Http\Message\RequestInterface $request = null) {
$accepted_languages = null;
if ($request === null) {
$accepted_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$accepted_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? null;
} elseif ($request->hasHeader('Accept-Language')) {
$accepted_languages = $request->getHeaderLine('Accept-Language');
}
......
......@@ -130,7 +130,7 @@ class Seminar_Session
return self::$current_session_state;
}
$state = false;
if (is_object($GLOBALS['user'])) {
if (isset($GLOBALS['user']) && is_object($GLOBALS['user'])) {
$state = in_array($GLOBALS['user']->id, ['nobody', 'form']) ? 'nobody' : 'authenticated';
} else {
$sid = $_COOKIE[__CLASS__];
......@@ -157,7 +157,7 @@ class Seminar_Session
*/
public static function get_session_vars($sid)
{
$sess = $GLOBALS['sess'];
$sess = $GLOBALS['sess'] ?? null;
if (!is_object($sess)) {
$sess = new self();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment