? ? Failure

User tests: Successful: Unsuccessful:

avatar frankmayer
frankmayer
30 Sep 2016

[UPDATED (6.1.2017) - see second paragraph]
Performance (and a bit of cleanup) Batch #2

The changes in this batch are all in files under libraries/legacy.
This PR modifies code to be a bit more performant and also does some cleanup.

I have mostly done work on low hanging fruit. There are still other ways of improving, but whose involve more deep research in the code and probably more drastic changes in order to be implemented.

[Update 6.1.2017]
In order to lighten this PR up, I have introduced 6 sub-PRs, which are easier to digest and mostly with very specific changes. In order to continue with this one, those ones should be tested/reviewed/merged first. After that, I can resolve the conflicts and there should finally be only a few changes left.

  • 1) Replace unnecessary double quotes in libraries/legacy #13239
  • 2) Simplify some ternary operations using elvis operator and remove unnecessary parentheses in libraries/legacy #13240
  • 3) Various changes in libraries legacy #13241
avatar frankmayer frankmayer - open - 30 Sep 2016
avatar frankmayer frankmayer - change - 30 Sep 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Sep 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 30 Sep 2016
Category Libraries
avatar sovainfo
sovainfo - comment - 30 Sep 2016

Could you explain when '== 0' is oke and when it needs '=== 0' ?

avatar mbabker
mbabker - comment - 30 Sep 2016

=== is more strict than ==, it will validate that something matches both the value and data type (so in that case 0 === '0' would fail but 0 == '0' is OK).

It's useful with some of the string functions where you can have a boolean false and an integer zero return. With == the values are compared to represent the same thing but with === they aren't.

avatar mahagr
mahagr - comment - 3 Oct 2016

@sovainfo The main issue with == comparison is that sometimes it casts the values in very odd way, for example:

    echo (0 == 'asd') ? 'true' : 'false'; // true

Which is just wrong. On the other hand you really need to be careful with === as if you're comparing different types, it always returns false. This is true especially with all (integer) values coming from DB, which are always strings, but usually integers if you happen to update value of the object:

    echo (0 === '0') ? 'true' : 'false'; // false
avatar sovainfo
sovainfo - comment - 3 Oct 2016

Thank you all for the feedback. For some reason thought that 'null' would never compare equal to anything, not even 'null'. Maybe that only applies to SQL, requiring you to use 'IS NULL'.

Concerning values coming from the database, expect the driver to make sure the right datatype to be returned. Apparently it doesn't.

avatar frankmayer frankmayer - change - 12 Dec 2016
The description was changed
avatar frankmayer
frankmayer - comment - 12 Dec 2016

Conflicts resolved

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Dec 2016

I have tested this item successfully on 6334b30

code review


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

avatar andrepereiradasilva andrepereiradasilva - test_item - 12 Dec 2016 - Tested successfully
avatar anibalsanchez
anibalsanchez - comment - 5 Jan 2017

I have tested this item successfully on 6334b30

Code review OK


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

avatar anibalsanchez anibalsanchez - test_item - 5 Jan 2017 - Tested successfully
avatar jeckodevelopment
jeckodevelopment - comment - 6 Jan 2017

@frankmayer can you please look at the conflicting file?

avatar frankmayer frankmayer - edited - 6 Jan 2017
avatar frankmayer
frankmayer - comment - 6 Jan 2017

@jeckodevelopment Thanks, done.

avatar frankmayer
frankmayer - comment - 6 Jan 2017

Edited initial post to show which sub-PRs still have to go through, in order to make this one easier to digest.
It would be great if the initial big batch PRs of mine could make it into alpha2. Thanks!

avatar frankmayer frankmayer - change - 13 Jun 2017
The description was changed
avatar frankmayer frankmayer - edited - 13 Jun 2017
avatar andrepereiradasilva
andrepereiradasilva - comment - 13 Jun 2017

I have tested this item successfully on 0148c52

code review


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

avatar andrepereiradasilva andrepereiradasilva - test_item - 13 Jun 2017 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 13 Jun 2017

I have tested this item successfully on 0148c52

code review


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

avatar andrepereiradasilva andrepereiradasilva - test_item - 13 Jun 2017 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 13 Jun 2017

I have tested this item successfully on 0148c52


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

avatar andrepereiradasilva andrepereiradasilva - test_item - 13 Jun 2017 - Tested successfully
avatar Quy
Quy - comment - 13 Jun 2017

I have tested this item successfully on 0148c52

Code review.


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

avatar Quy Quy - test_item - 13 Jun 2017 - Tested successfully
avatar frankmayer
frankmayer - comment - 15 Jun 2017

RTC please, thank you

avatar franz-wohlkoenig franz-wohlkoenig - change - 15 Jun 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Jun 2017

RTC after two successful tests.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 15 Jun 2017

Thanks for Hint, @frankmayer

avatar rdeutz rdeutz - change - 21 Jun 2017
Milestone Added:
avatar rdeutz rdeutz - change - 21 Jun 2017
Milestone Added:
avatar frankmayer
frankmayer - comment - 28 Jun 2017

Merge pls?

avatar rdeutz rdeutz - change - 5 Jul 2017
Milestone Added:
avatar rdeutz rdeutz - change - 5 Jul 2017
Milestone Removed:
avatar mbabker mbabker - change - 25 Jul 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-07-25 23:48:04
Closed_By mbabker
avatar mbabker mbabker - close - 25 Jul 2017
avatar mbabker mbabker - merge - 25 Jul 2017

Add a Comment

Login with GitHub to post a comment