Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Open to all! Ask other shopowners for help.
PiLLaO
100+
Posts: 140
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 75 times
Been thanked: 19 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by PiLLaO »

This code works for me

Code: Select all

// set SID once, even if empty
  $SID = (!isset($_COOKIE[session_name()]) ? session_name() . '=' . session_id() : '');
IA helps me to see that need to use $_COOKIE[session_name()]

I look con my 1.1.0.6 and first time on website $_COOKIE[session_name()] is NULL and after first click have the session_id() and ceid is hide.

Using the previous code reproduce the same action



Join The Code Co-op to get access to your library in the Code Co-op Forum
PiLLaO
100+
Posts: 140
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 75 times
Been thanked: 19 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by PiLLaO »

@burt @BrockleyJohn any news about this issue?

Best Regards

User avatar
burt
Core Team
Posts: 4911
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 296 times
Been thanked: 494 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by burt »

https://github.com/CE-PhoenixCart/Phoen ... 77a35aae8b

Revert (by deleting the new file and undoing the one line code change) and test ?
This will show whether or not the problem is in this commit.
I am not here to build for you.
I am here to build with you. Let's help each other.

PiLLaO
100+
Posts: 140
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 75 times
Been thanked: 19 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by PiLLaO »

Yes, this commit causes ceid never hide.

As I put here, the change in includes/system/segments/application/start_session.php causes this issue
PiLLaO wrote: ↑Tue Oct 20, 2026 4:09 pm As I see it, the original code contained the session name and ID only upon the first visit to the website; afterwards, it was always empty, which is why it wasn't being appended to the URLs.

The new code, $SID always contains the session name and ID, and for that reason, it is always appended to the URL.

Piece of code from includes/system/versioned/1.0.8.5/href.php

Code: Select all

// Add the session ID when SID is defined
      if ( $this->include_session
        && Session::is_started()
        && isset($GLOBALS['SID'])
        && !Text::is_empty($GLOBALS['SID']))
      {
        $this->parameters[session_name()] = session_id();
      }

User avatar
BrockleyJohn
Certified Developer
Posts: 162
Joined: Mon Mar 01, 2021 5:37 pm
Phoenix Version: too.ashamed.to.say
Has thanked: 2 times
Been thanked: 41 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by BrockleyJohn »

I believe the best solution is to keep the new version of the form class and to update application/start_session.php as suggested

Code: Select all

// set SID once, even if empty
  $SID = (! isset($_COOKIE[session_name()]) ? session_name() . '=' . session_id() : '');
Edit: reverting the commit's change to that line eliminates urls all having session id when cookies aren't forced.

This works fine on shared unix hosting, I am testing on other platforms and will get back to you.

The new version of the form class fixes a deprecated notice so we don't want to delete it.

User avatar
BrockleyJohn
Certified Developer
Posts: 162
Joined: Mon Mar 01, 2021 5:37 pm
Phoenix Version: too.ashamed.to.say
Has thanked: 2 times
Been thanked: 41 times

Re: Sessions Settings - Possible regression with `Form::hide_session_id()` after PHP 8.4 session changes (v1.1.0.7)

Post by BrockleyJohn »

The corresponding change for admin is to add in admin/includes/application_top.php after Session::start()

Code: Select all

  
  // set SID empty since admin cookies are compelled
  $SID = '';
The effect is that formid is no longer added to admin get forms, but is still added to post forms whether cookies are forced or not. Get forms do not redirect to storefront, post forms still work.
Tested on gets in orders.php and catalog.php, posts in catalog.php and various addon ajax posts.



Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply