? ? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
11 May 2021

Pull Request for Issue #33740

Summary of Changes

Cast session_id to a string before we use it

Testing Instructions

#33740

Actual result BEFORE applying this Pull Request

Cant logout under some circumstances with pgsql

Expected result AFTER applying this Pull Request

Can logout with no errors under some circumstances with pgsql

Documentation Changes Required

avatar PhilETaylor PhilETaylor - open - 11 May 2021
avatar PhilETaylor PhilETaylor - change - 11 May 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 May 2021
Category Libraries
avatar PhilETaylor
PhilETaylor - comment - 11 May 2021

Drone issue unrelated.

avatar richard67
richard67 - comment - 11 May 2021

@PhilETaylor Sure that is the solution? When I add a error_log((string) $sessionId); just before the changed line and have session handler set to filesystem so I can reproduce the problem, I get in the error log: Resource id #386.

With the code change I had proposed in the issue, I did get the correct session ID in the log.

avatar PhilETaylor
PhilETaylor - comment - 11 May 2021

works-on-my-machine

No idea :)

avatar richard67
richard67 - comment - 11 May 2021

Well it doesn't cause that type error. But does it really destroy the session?

avatar richard67
richard67 - comment - 11 May 2021

With my code, the guest session was removed after login, with the code proposed here it isn't.

Update: I mean the session records in database when collection session metadata is switched on and the session handler is file system.

avatar joomdonation
joomdonation - comment - 12 May 2021

I think this PR does not work. See https://www.php.net/manual/en/language.types.string.php#language.types.string.casting

Resources are always converted to strings with the structure "Resource id #1", where 1 is the resource number assigned to the resource by PHP at runtime. While the exact structure of this string should not be relied on and is subject to change, it will always be unique for a given resource within the lifetime of a script being executed (ie a Web request or CLI process) and won't be reused

So from what I see, you don't see the PHP error because the code successfully convert the data to string, however, it return wrong Session ID as you can guess.

After some Google Search, I think we might have to accept the ugly code #33740 (comment) and move on.

avatar richard67
richard67 - comment - 12 May 2021

@PhilETaylor We cast stuff (e.g. objects) to strings here and there, but on a quick search yesterday I haven't found any place where we do that for resources. If you find such a place, please report it with a new issue because that would be a bug, as far as I understand PHP docs.

avatar richard67
richard67 - comment - 12 May 2021

Alternative PR see #33819 .

avatar rdeutz rdeutz - change - 12 May 2021
Title
[4][Release Blocker] Cast session_id to string before destorying it
[4] Cast session_id to string before destorying it
avatar rdeutz rdeutz - edited - 12 May 2021
avatar brianteeman
brianteeman - comment - 12 May 2021

Can you update the title please. We should use tags to indicate release blocker

avatar richard67 richard67 - change - 12 May 2021
Title
[4] Cast session_id to string before destorying it
[4] Cast session_id to string before destroying it
avatar richard67 richard67 - edited - 12 May 2021
avatar PhilETaylor
PhilETaylor - comment - 12 May 2021

Closing in favour of #33819

avatar PhilETaylor PhilETaylor - change - 12 May 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-05-12 09:36:01
Closed_By PhilETaylor
Labels Added: ? ?
avatar PhilETaylor PhilETaylor - close - 12 May 2021
avatar PhilETaylor
PhilETaylor - comment - 12 May 2021

We should use tags to indicate release blocker

Not everyone has the permissions to add tags.

avatar PhilETaylor
PhilETaylor - comment - 12 May 2021

Please remove the tag release blocker - this PR is now closed.

Add a Comment

Login with GitHub to post a comment