Skip to content

Commit 7287f8a

Browse files
committed
Add null coalescing checks for typed calls
1 parent 5bde0d9 commit 7287f8a

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

src/Templates/Comment/Delete.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require('./Includes/header.inc.phtml'); ?>
3131

3232
<h2 class="text-danger">Delete Comment</h2>
3333
<p class="text-danger">Are you sure you wish to delete this comment?</p>
34-
<form method="POST" action="?id=<?=rawurlencode($id)?>">
34+
<form method="POST" action="?id=<?=rawurlencode($id ?? '')?>">
3535
<table class="table table-striped text-white-50"><tbody>
3636
<tr><td><a href="<?=$c_user_url?>"><img class="avatar" src="<?=$c_user_avatar?>"/> <?=filter_var($c_user_name, FILTER_SANITIZE_FULL_SPECIAL_CHARS)?></a><br/><time class="comment_timestamp" datetime="<?=$c->getCreatedDateTime()->format('c')?>"><?=$c->getCreatedDateTime()->format('D M j, Y g:ia T')?></time></td><td><?=$c->getContent(true)?></td></tr>
3737
</tbody></table>

src/Templates/Comment/Section.inc.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $c_delete_visible_admin = ($active_user && $active_user->getOption(User::OPTION_
1616
<? } else {
1717
foreach ($comments as $c) {
1818
$c_created_dt = $c->getCreatedDateTime();
19-
$c_id = rawurlencode($c->getId());
19+
$c_id = rawurlencode($c->getId() ?? '');
2020
$c_parent_url = $c->getParentUrl();
2121
$c_user = $c->getUser();
2222
$c_user_id = $c->getUserId();

src/Templates/Document/Edit.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require('./Includes/header.inc.phtml'); ?>
2929
<? if ($this->getContext()->acl_allowed) { ?>
3030
<h1><?=$title?></h1>
3131
<p><?=$description?></p>
32-
<? if (is_null($error) || $error == 'NOT_FOUND') {
32+
<? if (is_null($error) || $error == EditModel::ERROR_NOT_FOUND) {
3333
require('./Document/Form.inc.phtml');
3434
$comment_parent_type = Comment::PARENT_TYPE_DOCUMENT; $comment_parent_id = $document_id; require('./Comment/Section.inc.phtml');
3535
} else if ($error !== false) { ?>

src/Templates/Document/View.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else
1919
$description = 'The requested document does not exist or could not be found.';
2020
}
2121
$_header_meta_properties = ['og:type' => 'article'];
22-
$url = UrlFormatter::format('/document/' . rawurlencode($object_id));
22+
$url = UrlFormatter::format('/document/' . rawurlencode($object_id ?? ''));
2323
if ($object)
2424
{
2525
$url = $object->getURI();

src/Templates/EventLog/View.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $description = 'The event log viewer on BNETDocs';
1010
$object_id = $this->getContext()->id;
1111
$object = $this->getContext()->event;
1212

13-
$url = ($object instanceof Event) ? $object->getURI() : '/eventlog/view?id=' . rawurlencode($object_id);
13+
$url = ($object instanceof Event) ? $object->getURI() : '/eventlog/view?id=' . rawurlencode($object_id ?? '');
1414

1515
$object_ip_address = ($object instanceof Event ? $object->getIPAddress() : null);
1616
$object_metadata = ($object instanceof Event ? $object->getMetaData() : null);

src/Templates/Packet/View.phtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ if ($object)
4343
}
4444
}
4545

46-
$edit_url = UrlFormatter::format('/packet/edit?id=' . rawurlencode($object_id));
47-
$delete_url = UrlFormatter::format('/packet/delete?id=' . rawurlencode($object_id));
46+
$edit_url = UrlFormatter::format('/packet/edit?id=' . rawurlencode($object_id ?? ''));
47+
$delete_url = UrlFormatter::format('/packet/delete?id=' . rawurlencode($object_id ?? ''));
4848
$edit_visible = ($active_user && $active_user->getOption(User::OPTION_ACL_PACKET_MODIFY));
4949
$delete_visible = ($active_user && $active_user->getOption(User::OPTION_ACL_PACKET_DELETE));
5050

src/Templates/User/View.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $user_profile = $this->getContext()->user_profile;
1616
$user_verified = $user && $user->isVerified();
1717
$title = ($user ? $user->getName() : 'User Not Found');
1818
$description = ($user ? $user->getName() . '\'s user profile on BNETDocs' : 'The requested user does not exist or could not be found.');
19-
$url = ($user ? $user->getURI() : UrlFormatter::format('/user/' . rawurlencode($user_id)));
19+
$url = ($user ? $user->getURI() : UrlFormatter::format('/user/' . rawurlencode($user_id ?? '')));
2020
$_header_meta_properties = ['og:type' => 'profile'];
2121

2222
if ($user)

0 commit comments

Comments
 (0)