?
avatar alex-filat
alex-filat
18 May 2016

Steps to reproduce the issue

Request the user with active user id
f.e. JFactory::getUser(308), assuming logged in user's id is 308

Expected result

below condition must be false
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/factory.php#L246
elseif (!($instance instanceof JUser) || is_string($id) || $instance->id !== $id)

Actual result

but this condition alway true becouse
$instance->id !== $id is always true because $instance->id is string type and $id must be not string type

avatar alex-filat alex-filat - open - 18 May 2016
avatar brianteeman brianteeman - change - 18 May 2016
Category Libraries
avatar infograf768
infograf768 - comment - 19 May 2016

As far as I know, $id is also a string

object(JUser)[33]
  protected 'isRoot' => null
  public 'id' => string '122' (length=3)

```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/10543">issues.joomla.org/joomla-cms/10543</a>.</sub>
avatar alex-filat
alex-filat - comment - 19 May 2016

That is the problem. If we pass id type string then condition is true and function will create new user instead of return the existing.

avatar brianteeman brianteeman - change - 23 May 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 May 2016
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 23 May 2016
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Apr 2017
Status New Needs Review
avatar Quy
Quy - comment - 8 Dec 2017

Since is_string($id) condition is true, the last condition will not be evaluated. This issue can be closed.

avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Dec 2017
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2017-12-09 06:55:44
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 9 Dec 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 9 Dec 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 9 Dec 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 9 Dec 2017

closed as stated above.

Thanks @Quy.


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

Add a Comment

Login with GitHub to post a comment