Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

views/default/core/ajax/edit_comment.php (1 issue)

Checks if the types of the passed arguments in a function/method call are compatible.

Bug Minor
1
<?php
2
/**
3
 * Elgg ajax edit comment form
4
 *
5
 * @package Elgg
6
 * @subpackage Core
7
 */
8
9
$guid = get_input('guid');
10
11
$comment = get_entity($guid);
0 ignored issues
show
It seems like $guid can also be of type string; however, parameter $guid of get_entity() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

11
$comment = get_entity(/** @scrutinizer ignore-type */ $guid);
Loading history...
12
$entity = $comment->getContainerEntity();
13
elgg_set_page_owner_guid($entity->getContainerGUID());
14
15
if (!($comment instanceof ElggComment) || !$comment->canEdit()) {
16
	return false;
17
}
18
19
$form_vars = [
20
	'class' => 'hidden mvl',
21
	'id' => "edit-comment-{$guid}",
22
];
23
$body_vars = [
24
	'comment' => $comment,
25
];
26
echo elgg_view_form('comment/save', $form_vars, $body_vars);
27