session_decode_variation2.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. --TEST--
  2. Test session_decode() function : basic functionality
  3. --SKIPIF--
  4. <?php include('skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. ob_start();
  8. /*
  9. * Prototype : string session_decode(void)
  10. * Description : Decodes session data from a string
  11. * Source code : ext/session/session.c
  12. */
  13. echo "*** Testing session_decode() : variation ***\n";
  14. var_dump(session_start());
  15. var_dump($_SESSION);
  16. $_SESSION["foo"] = 1234567890;
  17. $_SESSION["bar"] = "Hello World!";
  18. $_SESSION["guff"] = 123.456;
  19. var_dump($_SESSION);
  20. var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
  21. var_dump($_SESSION);
  22. var_dump(session_destroy());
  23. echo "Done";
  24. ob_end_flush();
  25. ?>
  26. --EXPECTF--
  27. *** Testing session_decode() : variation ***
  28. bool(true)
  29. array(0) {
  30. }
  31. array(3) {
  32. ["foo"]=>
  33. int(1234567890)
  34. ["bar"]=>
  35. string(12) "Hello World!"
  36. ["guff"]=>
  37. float(123.456)
  38. }
  39. bool(true)
  40. array(4) {
  41. ["foo"]=>
  42. &array(3) {
  43. [0]=>
  44. int(1)
  45. [1]=>
  46. int(2)
  47. [2]=>
  48. int(3)
  49. }
  50. ["bar"]=>
  51. string(12) "Hello World!"
  52. ["guff"]=>
  53. &array(3) {
  54. [0]=>
  55. int(1)
  56. [1]=>
  57. int(2)
  58. [2]=>
  59. int(3)
  60. }
  61. ["blah"]=>
  62. &array(3) {
  63. [0]=>
  64. int(1)
  65. [1]=>
  66. int(2)
  67. [2]=>
  68. int(3)
  69. }
  70. }
  71. bool(true)
  72. Done