Skip to content
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

[4.0] Type-safe string comparisons in libraries #27194

Merged
merged 8 commits into from
Feb 8, 2020
Merged

[4.0] Type-safe string comparisons in libraries #27194

merged 8 commits into from
Feb 8, 2020

Conversation

SharkyKZ
Copy link
Contributor

@SharkyKZ SharkyKZ commented Dec 2, 2019

Summary of Changes

Adds type-safe comparisons where appropriate.

Testing Instructions

Code review.

Documentation Changes Required

No.

@@ -698,7 +698,7 @@ public function load($extension = 'joomla', $basePath = JPATH_BASE, $lang = null

$path = LanguageHelper::getLanguagePath($basePath, $lang);

$internal = $extension == 'joomla' || $extension == '';
$internal = $extension === 'joomla' || $extension == '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$internal = $extension === 'joomla' || $extension == '';
$internal = $extension === 'joomla' || $extension === '';

Copy link
Contributor Author

@SharkyKZ SharkyKZ Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this as this concerns a function argument. Although it is documented as string, some may say it's a B/C break (because currently null works). Maintainers decide.

@Quy Quy added the PR-4.0-dev label Dec 2, 2019
Co-Authored-By: Quy <quy@fluxbb.org>
@Quy
Copy link
Contributor

Quy commented Dec 2, 2019

I have tested this item ✅ successfully on ca295ab


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27194.

@ChristineWk
Copy link

I'm afraid - maybe tested it wrong?
Checked the files/lines of: ca295ab via FTP.
1st was succesful - 2nd & 3rd unsuccesful.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27194.

@SharkyKZ
Copy link
Contributor Author

SharkyKZ commented Dec 5, 2019

@ChristineWk This needs to be tested by code review only. If you're familiar with PHP code, review the changes here https://github.com/joomla/joomla-cms/pull/27194/files.

@ChristineWk
Copy link

Thanks @SharkyKZ In the meantime, checked apprx. 20 files incld. given lines :-) successfully.
The last one: UserHelper.php & Uri.php: not successful. Maybe there was timed out? OK, will advise when I hv all :-)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27194.

@alikon alikon added the GSoC label Jan 15, 2020
@@ -49,7 +49,7 @@ public function filter(\SimpleXMLElement $element, $value, $group = null, Regist
{
if ($p !== '')
{
$return[$action][$id] = ($p == '1' || $p == 'true') ? true : false;
$return[$action][$id] = ($p == '1' || $p === 'true') ? true : false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$return[$action][$id] = ($p == '1' || $p === 'true') ? true : false;
$return[$action][$id] = ($p === '1' || $p === 'true') ? true : false;

@wilsonge wilsonge merged commit 4d64086 into joomla:4.0-dev Feb 8, 2020
@wilsonge
Copy link
Contributor

wilsonge commented Feb 8, 2020

Thanks! @Quy are you ok to make that last change you proposed? Just in the interests of getting this merged

@wilsonge wilsonge added this to the Joomla 4.0 milestone Feb 8, 2020
@Quy
Copy link
Contributor

Quy commented Feb 8, 2020

Let me double check and will submit a PR if necessary.

@SharkyKZ SharkyKZ deleted the j4/strict/string/libraries branch February 8, 2020 16:29
@SharkyKZ
Copy link
Contributor Author

SharkyKZ commented Feb 8, 2020

Sorry. I forgot to respond to suggested change. I haven't looked at it properly so not sure if it's right. It seems to concern a form feld value, in which case I'd leave it as is. Just in case we might start storing those values as integers.

brianteeman pushed a commit to brianteeman/joomla-cms that referenced this pull request Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants