My source Yii have this problem , when i use xdebug. I don't know why.

- 7,475
- 3
- 30
- 50

- 1
- 1
- 1
-
Where do you use this class? – Koala Yeung Oct 15 '19 at 07:38
-
Possible duplicate of [PHP 7.2 Warning: "Cannot change session name when session is active"](https://stackoverflow.com/questions/47700336/php-7-2-warning-cannot-change-session-name-when-session-is-active) – FallenBG Oct 15 '19 at 07:49
3 Answers
It looks like you use Yii 1 with PHP 7.2 According to this post and number of other sources like this one and this one, you have a yii bug that can be reported here
The answer from the other topic:
I have done a bug report at php.net and they explained that this is not a bug. Yes in PHP 7.2 a warning is generated now. However this never worked as intended, it just failed silently.
For creating multiple sessions it is required to use session_id(). Have a look at this related question: PHP How can I create multiple sessions?
session_name() as well as session_set_cookie_params() are always nonesense if the session is already running.
For the original answer have a look here: https://bugs.php.net/bug.php?id=75650&thanks=2

- 26
- 3
Simple fix:
function _read($id)
PHP 7.0 -> if is empty return false
PHP 7.2 -> if is empty return ''
then add @ to other functions and remember to run session_name before session start
@session_name('SOMEID');
@session_start(...
...
@session_set_save_handler(...

- 5,316
- 3
- 40
- 50
It's work for me:
- Make new class
SomeSession
inprotected/components
folder:
class SomeSession extends CCacheHttpSession
{
public function open()
{
// don't start new session if session is started now
if (session_status() === PHP_SESSION_NONE)
{
parent::open();
}
}
- in
main.php
insession
section edit:
'session' => [
'class' => SomeSession::class,
'sessionName' => 'SomeSessionName',
'autoStart' => true,
'cookieMode' => 'allow',
]
- done =]

- 1