bug70133.phpt 802 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Bug #70133 (Extended SessionHandler::read is ignoring $session_id when calling parent)
  3. --EXTENSIONS--
  4. session
  5. --SKIPIF--
  6. <?php include('skipif.inc'); ?>
  7. --INI--
  8. session.save_handler=files
  9. session.save_path=
  10. session.use_strict_mode=0
  11. --FILE--
  12. <?php
  13. class CustomReadHandler extends \SessionHandler {
  14. public function read($session_id): string|false {
  15. return parent::read('mycustomsession');
  16. }
  17. }
  18. ob_start();
  19. session_set_save_handler(new CustomReadHandler(), true);
  20. session_id('mycustomsession');
  21. session_start();
  22. $_SESSION['foo'] = 'hoge';
  23. var_dump(session_id());
  24. session_commit();
  25. session_id('otherid');
  26. session_start();
  27. var_dump($_SESSION);
  28. var_dump(session_id());
  29. ?>
  30. --EXPECT--
  31. string(15) "mycustomsession"
  32. array(1) {
  33. ["foo"]=>
  34. string(4) "hoge"
  35. }
  36. string(7) "otherid"