session_decode_error2.phpt 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. --TEST--
  2. Test session_decode() function : error 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() : error functionality ***\n";
  14. $data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
  15. var_dump(session_start());
  16. for($index = 0; $index < strlen($data); $index++) {
  17. if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
  18. echo "\n-- Iteration $index --\n";
  19. $encoded = substr($data, 0, $index);
  20. var_dump(session_decode($encoded));
  21. var_dump($_SESSION);
  22. };
  23. var_dump(session_destroy());
  24. echo "Done";
  25. ob_end_flush();
  26. ?>
  27. --EXPECTF--
  28. *** Testing session_decode() : error functionality ***
  29. bool(true)
  30. -- Iteration 0 --
  31. bool(true)
  32. array(0) {
  33. }
  34. -- Iteration 1 --
  35. bool(true)
  36. array(0) {
  37. }
  38. -- Iteration 2 --
  39. bool(true)
  40. array(0) {
  41. }
  42. -- Iteration 3 --
  43. bool(true)
  44. array(0) {
  45. }
  46. -- Iteration 4 --
  47. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  48. bool(false)
  49. array(0) {
  50. }
  51. -- Iteration 5 --
  52. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  53. bool(false)
  54. array(0) {
  55. }
  56. -- Iteration 6 --
  57. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  58. bool(false)
  59. array(0) {
  60. }
  61. -- Iteration 7 --
  62. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  63. bool(false)
  64. array(0) {
  65. }
  66. -- Iteration 8 --
  67. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  68. bool(false)
  69. array(0) {
  70. }
  71. -- Iteration 9 --
  72. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  73. bool(false)
  74. array(0) {
  75. }
  76. -- Iteration 10 --
  77. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  78. bool(false)
  79. array(0) {
  80. }
  81. -- Iteration 11 --
  82. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  83. bool(false)
  84. array(0) {
  85. }
  86. -- Iteration 12 --
  87. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  88. bool(false)
  89. array(0) {
  90. }
  91. -- Iteration 13 --
  92. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  93. bool(false)
  94. array(0) {
  95. }
  96. -- Iteration 14 --
  97. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  98. bool(false)
  99. array(0) {
  100. }
  101. -- Iteration 15 --
  102. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  103. bool(false)
  104. array(0) {
  105. }
  106. -- Iteration 16 --
  107. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  108. bool(false)
  109. array(0) {
  110. }
  111. -- Iteration 17 --
  112. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  113. bool(false)
  114. array(0) {
  115. }
  116. -- Iteration 18 --
  117. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  118. bool(false)
  119. array(0) {
  120. }
  121. -- Iteration 19 --
  122. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  123. bool(false)
  124. array(0) {
  125. }
  126. -- Iteration 20 --
  127. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  128. bool(false)
  129. array(0) {
  130. }
  131. -- Iteration 21 --
  132. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  133. bool(false)
  134. array(0) {
  135. }
  136. -- Iteration 22 --
  137. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  138. bool(false)
  139. array(0) {
  140. }
  141. -- Iteration 23 --
  142. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  143. bool(false)
  144. array(0) {
  145. }
  146. -- Iteration 24 --
  147. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  148. bool(false)
  149. array(0) {
  150. }
  151. -- Iteration 25 --
  152. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  153. bool(false)
  154. array(0) {
  155. }
  156. -- Iteration 26 --
  157. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  158. bool(false)
  159. array(0) {
  160. }
  161. -- Iteration 27 --
  162. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  163. bool(false)
  164. array(0) {
  165. }
  166. -- Iteration 28 --
  167. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  168. bool(false)
  169. array(0) {
  170. }
  171. -- Iteration 29 --
  172. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  173. bool(false)
  174. array(0) {
  175. }
  176. -- Iteration 30 --
  177. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  178. bool(false)
  179. array(0) {
  180. }
  181. -- Iteration 31 --
  182. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  183. bool(false)
  184. array(0) {
  185. }
  186. -- Iteration 32 --
  187. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  188. bool(false)
  189. array(0) {
  190. }
  191. -- Iteration 33 --
  192. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  193. bool(false)
  194. array(0) {
  195. }
  196. -- Iteration 34 --
  197. bool(true)
  198. array(1) {
  199. ["foo"]=>
  200. array(3) {
  201. [0]=>
  202. int(1)
  203. [1]=>
  204. int(2)
  205. [2]=>
  206. int(3)
  207. }
  208. }
  209. -- Iteration 35 --
  210. bool(true)
  211. array(1) {
  212. ["foo"]=>
  213. array(3) {
  214. [0]=>
  215. int(1)
  216. [1]=>
  217. int(2)
  218. [2]=>
  219. int(3)
  220. }
  221. }
  222. -- Iteration 36 --
  223. bool(true)
  224. array(1) {
  225. ["foo"]=>
  226. array(3) {
  227. [0]=>
  228. int(1)
  229. [1]=>
  230. int(2)
  231. [2]=>
  232. int(3)
  233. }
  234. }
  235. -- Iteration 37 --
  236. bool(true)
  237. array(1) {
  238. ["foo"]=>
  239. array(3) {
  240. [0]=>
  241. int(1)
  242. [1]=>
  243. int(2)
  244. [2]=>
  245. int(3)
  246. }
  247. }
  248. -- Iteration 38 --
  249. bool(true)
  250. array(1) {
  251. ["foo"]=>
  252. array(3) {
  253. [0]=>
  254. int(1)
  255. [1]=>
  256. int(2)
  257. [2]=>
  258. int(3)
  259. }
  260. }
  261. -- Iteration 39 --
  262. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  263. bool(false)
  264. array(0) {
  265. }
  266. -- Iteration 40 --
  267. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  268. bool(false)
  269. array(0) {
  270. }
  271. -- Iteration 41 --
  272. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  273. bool(false)
  274. array(0) {
  275. }
  276. -- Iteration 42 --
  277. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  278. bool(false)
  279. array(0) {
  280. }
  281. -- Iteration 43 --
  282. bool(true)
  283. array(2) {
  284. ["foo"]=>
  285. &array(3) {
  286. [0]=>
  287. int(1)
  288. [1]=>
  289. int(2)
  290. [2]=>
  291. int(3)
  292. }
  293. ["guff"]=>
  294. &array(3) {
  295. [0]=>
  296. int(1)
  297. [1]=>
  298. int(2)
  299. [2]=>
  300. int(3)
  301. }
  302. }
  303. -- Iteration 44 --
  304. bool(true)
  305. array(2) {
  306. ["foo"]=>
  307. &array(3) {
  308. [0]=>
  309. int(1)
  310. [1]=>
  311. int(2)
  312. [2]=>
  313. int(3)
  314. }
  315. ["guff"]=>
  316. &array(3) {
  317. [0]=>
  318. int(1)
  319. [1]=>
  320. int(2)
  321. [2]=>
  322. int(3)
  323. }
  324. }
  325. -- Iteration 45 --
  326. bool(true)
  327. array(2) {
  328. ["foo"]=>
  329. &array(3) {
  330. [0]=>
  331. int(1)
  332. [1]=>
  333. int(2)
  334. [2]=>
  335. int(3)
  336. }
  337. ["guff"]=>
  338. &array(3) {
  339. [0]=>
  340. int(1)
  341. [1]=>
  342. int(2)
  343. [2]=>
  344. int(3)
  345. }
  346. }
  347. -- Iteration 46 --
  348. bool(true)
  349. array(2) {
  350. ["foo"]=>
  351. &array(3) {
  352. [0]=>
  353. int(1)
  354. [1]=>
  355. int(2)
  356. [2]=>
  357. int(3)
  358. }
  359. ["guff"]=>
  360. &array(3) {
  361. [0]=>
  362. int(1)
  363. [1]=>
  364. int(2)
  365. [2]=>
  366. int(3)
  367. }
  368. }
  369. -- Iteration 47 --
  370. bool(true)
  371. array(2) {
  372. ["foo"]=>
  373. &array(3) {
  374. [0]=>
  375. int(1)
  376. [1]=>
  377. int(2)
  378. [2]=>
  379. int(3)
  380. }
  381. ["guff"]=>
  382. &array(3) {
  383. [0]=>
  384. int(1)
  385. [1]=>
  386. int(2)
  387. [2]=>
  388. int(3)
  389. }
  390. }
  391. -- Iteration 48 --
  392. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  393. bool(false)
  394. array(0) {
  395. }
  396. -- Iteration 49 --
  397. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  398. bool(false)
  399. array(0) {
  400. }
  401. -- Iteration 50 --
  402. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  403. bool(false)
  404. array(0) {
  405. }
  406. -- Iteration 51 --
  407. Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
  408. bool(false)
  409. array(0) {
  410. }
  411. Warning: session_destroy(): Trying to destroy uninitialized session in %s%esession_decode_error2.php on line %d
  412. bool(false)
  413. Done