-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type safe comparison in plugins - second iteration #13272
Changes from 3 commits
39a2e07
d8e1eb7
e058414
cfaca22
90055f6
a52d3be
669da6f
4d9479e
572572c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,7 @@ private function displayVotingData($context, &$row, &$params, $page) | |
include $path; | ||
$html = ob_get_clean(); | ||
|
||
if ($this->app->input->getString('view', '') === 'article' && $row->state == 1) | ||
if ($this->app->input->getString('view', '') === 'article' && $row->state === 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doubt: is row state (and access in changes below) an int for sure in all cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you check this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, sorry, it got under. I checked it just now. You were right! Unfortunately it is not guaranteed that it is an int. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, I don't know if this has come up in the past, but if we want to do strict(er) typing, as we should, then I guess the db driver classes should make sure the right types are returned, also. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree, but a change like that IMHO should be in 4.0 branch |
||
{ | ||
// Get the path for the voting form layout file | ||
$path = JPluginHelper::getLayoutPath('content', 'vote', 'vote'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,15 +40,15 @@ public function onDisplay($name, $asset, $author) | |
$user = JFactory::getUser(); | ||
$extension = JFactory::getApplication()->input->get('option'); | ||
|
||
if ($asset == '') | ||
if ($asset === '') | ||
{ | ||
$asset = $extension; | ||
} | ||
|
||
if ($user->authorise('core.edit', $asset) | ||
|| $user->authorise('core.create', $asset) | ||
|| (count($user->getAuthorisedCategories($asset, 'core.create')) > 0) | ||
|| ($user->authorise('core.edit.own', $asset) && $author == $user->id) | ||
|| ($user->authorise('core.edit.own', $asset) && $author === $user->id) | ||
|| (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0) | ||
|| (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == $user->id)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and what about line 53 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes, missed that one... Thanks!! |
||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankmayer Should this be
=== null
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think It could, and I also think I have done this in another PR.