? Failure

User tests: Successful: Unsuccessful:

avatar nvyush
nvyush
1 Jun 2017

The check !empty($this->item) is unneeded at this point.
It is possible to join the statements of if conditions at the lines 72 and 77.

Pull Request for Issue #16409.

Summary of Changes

Unnecessary condition is removed.
The statements of equivalent conditions is joined.

Testing Instructions

Code review.

Expected result

Actual result

Documentation Changes Required

Not needed.

avatar nvyush nvyush - open - 1 Jun 2017
avatar nvyush nvyush - change - 1 Jun 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jun 2017
Category Front End com_content
avatar Bakual
Bakual - comment - 1 Jun 2017

Not sure if that is accurate.
Because the first check !empty($this->item->id)is only true when the item already has an id set and other than 0/false (means we edit an existing item).
The second check !empty($this->item) && isset($this->item->id) will be true if the item is valid, but the ID may also be 0 (means it can also be a new item).

avatar nvyush
nvyush - comment - 1 Jun 2017

Well, but check !empty($this->item) is not needed and can be removed. If $this->item is empty at this point, all checks $this->item->id above this line will be wrong. Are you agree?
I can update the commit.

avatar nvyush nvyush - change - 1 Jun 2017
Labels Added: ?
avatar nvyush
nvyush - comment - 1 Jun 2017

I do not understand, why commit 5ed1d17 is valid, but 6b585ae is not. I simple removed white spaces.

avatar Bakual
Bakual - comment - 1 Jun 2017

Imho, the isset should indeed be sufficient, because it will also return false if the item doesn't exist. So we gain nothing by explictiely checking the existence of the item prior to it.

I tried to restart the drone test. looks like an unrelated error to me.

avatar nvyush
nvyush - comment - 7 Jul 2017

@Bakual, why continuous-integration/jenkins/pr-merge reported an error? What I must do?

avatar rdeutz
rdeutz - comment - 7 Jul 2017

@nvyush you can ignore the jenkins failure for now, we are testing a new setup. It is important that the Required checks pass and the drone test (code styles) should also pass.

avatar nvyush
nvyush - comment - 7 Jul 2017

@rdeutz, thanks

avatar Quy Quy - test_item - 16 Nov 2017 - Tested successfully
avatar Quy
Quy - comment - 16 Nov 2017

I have tested this item successfully on 60788fd


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

avatar FPerisa
FPerisa - comment - 21 Dec 2017

For new items the ID is always NULL. Even by saying a_id=0 in the url. So why not joining the two if-conditions?


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

avatar Quy
Quy - comment - 21 Dec 2017

@FPerisa You're right. They can be combined and remove the second if statement.

avatar Quy Quy - change - 29 Apr 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-04-29 03:50:33
Closed_By Quy
avatar joomla-cms-bot
joomla-cms-bot - comment - 29 Apr 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/16412

avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2018
Closed_Date 2018-04-29 03:50:33 2018-04-29 03:50:34
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 29 Apr 2018
avatar Quy
Quy - comment - 29 Apr 2018

See PR #20254


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

Add a Comment

Login with GitHub to post a comment