# Warning when using session_regenerate_id(TRUE) with a SessionHandler

- Thread: https://externals.io/message/63682
- Original archive: https://news-web.php.net/php.internals/63682
- Started by dabo on 2012-10-28T03:05:59+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #63682 — dabo — 2012-10-28T03:05:59+00:00

URL: https://externals.io/message/63682#63682

Hi folks,

I believe there's an issue with the SessionHandler implementation and
the way the destroy handler is invoked when using
session_regenerate_id(TRUE)

Using latest stable Gentoo PHP 5.4.6 but as far as I could tell the C
code source for this part hasn't since been touched up to master.

The following code generates a warning :

$handler = new SessionHandler();
session_set_save_handler($handler, TRUE); // or FALSE, doesn't matter
 `session_start()`;
session_regenerate_id(TRUE);

//session_write_close();
-----------
PHP Warning:  Unknown: Parent session handler is not open in Unknown on line 0

The call to `session_write_close()` just adds a proper backtrace.

The problem seems to come from using the global "mod_user_is_open" in
the PS_SANITY_CHECK_IS_OPEN macro (in ext/session/mod_user_class.c).
Any reason "session_status" isn't checked instead ?

Can anyone confirm ?

Thank you

---

## #63689 — Laruence — 2012-10-28T10:24:56+00:00

URL: https://externals.io/message/63682#63689 · In reply to: #63682

Hey:
  could you please open a bug at bugs.php.net for that?

 thanks


> Hi folks,
>
> I believe there's an issue with the SessionHandler implementation and
> the way the destroy handler is invoked when using
> session_regenerate_id(TRUE)
>
> Using latest stable Gentoo PHP 5.4.6 but as far as I could tell the C
> code source for this part hasn't since been touched up to master.
>
> The following code generates a warning :
>
> $handler = new SessionHandler();
> session_set_save_handler($handler, TRUE); // or FALSE, doesn't matter
>
> `session_start()`;
> session_regenerate_id(TRUE);
>
> //session_write_close();
> -----------
> PHP Warning:  Unknown: Parent session handler is not open in Unknown on line 0
>
> The call to `session_write_close()` just adds a proper backtrace.
>
> The problem seems to come from using the global "mod_user_is_open" in
> the PS_SANITY_CHECK_IS_OPEN macro (in ext/session/mod_user_class.c).
> Any reason "session_status" isn't checked instead ?
>
> Can anyone confirm ?
>
> Thank you
>
>
> --
> 
> 
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #63697 — dabo — 2012-10-29T01:20:18+00:00

URL: https://externals.io/message/63682#63697 · In reply to: #63689

Done :


https://bugs.php.net/bug.php?id=63379



----- Mail original -----
De : Laruence <laruence@php.net>
À : dabo <avatar2004-php@yahoo.fr>
Cc : "internals@lists.php.net" <internals@lists.php.net>; Arpad Ray <arpad@php.net>
Envoyé le : Dimanche 28 octobre 2012 11h24
Objet : Re: [PHP-DEV] Warning when using session_regenerate_id(TRUE) with a SessionHandler

Hey:
  could you please open a bug at bugs.php.net for that?

thanks


> Hi folks,
>
> I believe there's an issue with the SessionHandler implementation and
> the way the destroy handler is invoked when using
> session_regenerate_id(TRUE)
>
> Using latest stable Gentoo PHP 5.4.6 but as far as I could tell the C
> code source for this part hasn't since been touched up to master.
>
> The following code generates a warning :
>
> $handler = new SessionHandler();
> session_set_save_handler($handler, TRUE); // or FALSE, doesn't matter
>
> `session_start()`;
> session_regenerate_id(TRUE);
>
> //session_write_close();
> -----------
> PHP Warning:  Unknown: Parent session handler is not open in Unknown on line 0
>
> The call to `session_write_close()` just adds a proper backtrace.
>
> The problem seems to come from using the global "mod_user_is_open" in
> the PS_SANITY_CHECK_IS_OPEN macro (in ext/session/mod_user_class.c).
> Any reason "session_status" isn't checked instead ?
>
> Can anyone confirm ?
>
> Thank you
>
>
> --
> 
> 
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/
