session_abort_basic.phpt 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Test session_abort() function : basic functionality
  3. --SKIPIF--
  4. <?php include('skipif.inc'); ?>
  5. --INI--
  6. session.save_path=
  7. session.name=PHPSESSID
  8. session.save_handler=files
  9. --FILE--
  10. <?php
  11. ob_start();
  12. /*
  13. * Prototype : void session_abort(void)
  14. * Description : Should abort session. Session data should not be written.
  15. * Source code : ext/session/session.c
  16. */
  17. echo "*** Testing session_abort() : basic functionality ***\n";
  18. session_start();
  19. $session_id = session_id();
  20. $_SESSION['foo'] = 123;
  21. session_commit();
  22. session_id($session_id);
  23. session_start();
  24. $_SESSION['bar'] = 456;
  25. var_dump($_SESSION);
  26. session_abort();
  27. session_id($session_id);
  28. session_start();
  29. var_dump($_SESSION); // Should only have 'foo'
  30. echo "Done".PHP_EOL;
  31. ?>
  32. --EXPECT--
  33. *** Testing session_abort() : basic functionality ***
  34. array(2) {
  35. ["foo"]=>
  36. int(123)
  37. ["bar"]=>
  38. int(456)
  39. }
  40. array(1) {
  41. ["foo"]=>
  42. int(123)
  43. }
  44. Done