File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / session_decode_error2.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Test session_decode() function : error functionality
    3: --SKIPIF--
    4: <?php include('skipif.inc'); ?>
    5: --FILE--
    6: <?php
    7: 
    8: ob_start();
    9: 
   10: /* 
   11:  * Prototype : string session_decode(void)
   12:  * Description : Decodes session data from a string
   13:  * Source code : ext/session/session.c 
   14:  */
   15: 
   16: echo "*** Testing session_decode() : error functionality ***\n";
   17: $data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
   18: 
   19: var_dump(session_start());
   20: for($index = 0; $index < strlen($data); $index++) {
   21:     echo "\n-- Iteration $index --\n";
   22:     $encoded = substr($data, 0, $index);
   23:     var_dump(session_decode($encoded));
   24:     var_dump($_SESSION);
   25: };
   26: 
   27: var_dump(session_destroy());
   28: echo "Done";
   29: ob_end_flush();
   30: ?>
   31: --EXPECTF--
   32: *** Testing session_decode() : error functionality ***
   33: bool(true)
   34: 
   35: -- Iteration 0 --
   36: bool(true)
   37: array(0) {
   38: }
   39: 
   40: -- Iteration 1 --
   41: bool(true)
   42: array(0) {
   43: }
   44: 
   45: -- Iteration 2 --
   46: bool(true)
   47: array(0) {
   48: }
   49: 
   50: -- Iteration 3 --
   51: bool(true)
   52: array(0) {
   53: }
   54: 
   55: -- Iteration 4 --
   56: bool(true)
   57: array(1) {
   58:   ["foo"]=>
   59:   NULL
   60: }
   61: 
   62: -- Iteration 5 --
   63: bool(true)
   64: array(1) {
   65:   ["foo"]=>
   66:   NULL
   67: }
   68: 
   69: -- Iteration 6 --
   70: bool(true)
   71: array(1) {
   72:   ["foo"]=>
   73:   NULL
   74: }
   75: 
   76: -- Iteration 7 --
   77: bool(true)
   78: array(1) {
   79:   ["foo"]=>
   80:   NULL
   81: }
   82: 
   83: -- Iteration 8 --
   84: bool(true)
   85: array(1) {
   86:   ["foo"]=>
   87:   NULL
   88: }
   89: 
   90: -- Iteration 9 --
   91: bool(true)
   92: array(1) {
   93:   ["foo"]=>
   94:   NULL
   95: }
   96: 
   97: -- Iteration 10 --
   98: bool(true)
   99: array(1) {
  100:   ["foo"]=>
  101:   NULL
  102: }
  103: 
  104: -- Iteration 11 --
  105: bool(true)
  106: array(1) {
  107:   ["foo"]=>
  108:   NULL
  109: }
  110: 
  111: -- Iteration 12 --
  112: bool(true)
  113: array(1) {
  114:   ["foo"]=>
  115:   NULL
  116: }
  117: 
  118: -- Iteration 13 --
  119: bool(true)
  120: array(1) {
  121:   ["foo"]=>
  122:   NULL
  123: }
  124: 
  125: -- Iteration 14 --
  126: bool(true)
  127: array(1) {
  128:   ["foo"]=>
  129:   NULL
  130: }
  131: 
  132: -- Iteration 15 --
  133: bool(true)
  134: array(1) {
  135:   ["foo"]=>
  136:   NULL
  137: }
  138: 
  139: -- Iteration 16 --
  140: bool(true)
  141: array(1) {
  142:   ["foo"]=>
  143:   NULL
  144: }
  145: 
  146: -- Iteration 17 --
  147: bool(true)
  148: array(1) {
  149:   ["foo"]=>
  150:   NULL
  151: }
  152: 
  153: -- Iteration 18 --
  154: bool(true)
  155: array(1) {
  156:   ["foo"]=>
  157:   NULL
  158: }
  159: 
  160: -- Iteration 19 --
  161: bool(true)
  162: array(1) {
  163:   ["foo"]=>
  164:   NULL
  165: }
  166: 
  167: -- Iteration 20 --
  168: bool(true)
  169: array(1) {
  170:   ["foo"]=>
  171:   NULL
  172: }
  173: 
  174: -- Iteration 21 --
  175: bool(true)
  176: array(1) {
  177:   ["foo"]=>
  178:   NULL
  179: }
  180: 
  181: -- Iteration 22 --
  182: bool(true)
  183: array(1) {
  184:   ["foo"]=>
  185:   NULL
  186: }
  187: 
  188: -- Iteration 23 --
  189: bool(true)
  190: array(1) {
  191:   ["foo"]=>
  192:   NULL
  193: }
  194: 
  195: -- Iteration 24 --
  196: bool(true)
  197: array(1) {
  198:   ["foo"]=>
  199:   NULL
  200: }
  201: 
  202: -- Iteration 25 --
  203: bool(true)
  204: array(1) {
  205:   ["foo"]=>
  206:   NULL
  207: }
  208: 
  209: -- Iteration 26 --
  210: bool(true)
  211: array(1) {
  212:   ["foo"]=>
  213:   NULL
  214: }
  215: 
  216: -- Iteration 27 --
  217: bool(true)
  218: array(1) {
  219:   ["foo"]=>
  220:   NULL
  221: }
  222: 
  223: -- Iteration 28 --
  224: bool(true)
  225: array(1) {
  226:   ["foo"]=>
  227:   NULL
  228: }
  229: 
  230: -- Iteration 29 --
  231: bool(true)
  232: array(1) {
  233:   ["foo"]=>
  234:   NULL
  235: }
  236: 
  237: -- Iteration 30 --
  238: bool(true)
  239: array(1) {
  240:   ["foo"]=>
  241:   NULL
  242: }
  243: 
  244: -- Iteration 31 --
  245: bool(true)
  246: array(1) {
  247:   ["foo"]=>
  248:   NULL
  249: }
  250: 
  251: -- Iteration 32 --
  252: bool(true)
  253: array(1) {
  254:   ["foo"]=>
  255:   NULL
  256: }
  257: 
  258: -- Iteration 33 --
  259: bool(true)
  260: array(1) {
  261:   ["foo"]=>
  262:   NULL
  263: }
  264: 
  265: -- Iteration 34 --
  266: bool(true)
  267: array(1) {
  268:   ["foo"]=>
  269:   array(3) {
  270:     [0]=>
  271:     int(1)
  272:     [1]=>
  273:     int(2)
  274:     [2]=>
  275:     int(3)
  276:   }
  277: }
  278: 
  279: -- Iteration 35 --
  280: bool(true)
  281: array(1) {
  282:   ["foo"]=>
  283:   array(3) {
  284:     [0]=>
  285:     int(1)
  286:     [1]=>
  287:     int(2)
  288:     [2]=>
  289:     int(3)
  290:   }
  291: }
  292: 
  293: -- Iteration 36 --
  294: bool(true)
  295: array(1) {
  296:   ["foo"]=>
  297:   array(3) {
  298:     [0]=>
  299:     int(1)
  300:     [1]=>
  301:     int(2)
  302:     [2]=>
  303:     int(3)
  304:   }
  305: }
  306: 
  307: -- Iteration 37 --
  308: bool(true)
  309: array(1) {
  310:   ["foo"]=>
  311:   array(3) {
  312:     [0]=>
  313:     int(1)
  314:     [1]=>
  315:     int(2)
  316:     [2]=>
  317:     int(3)
  318:   }
  319: }
  320: 
  321: -- Iteration 38 --
  322: bool(true)
  323: array(1) {
  324:   ["foo"]=>
  325:   array(3) {
  326:     [0]=>
  327:     int(1)
  328:     [1]=>
  329:     int(2)
  330:     [2]=>
  331:     int(3)
  332:   }
  333: }
  334: 
  335: -- Iteration 39 --
  336: bool(true)
  337: array(2) {
  338:   ["foo"]=>
  339:   array(3) {
  340:     [0]=>
  341:     int(1)
  342:     [1]=>
  343:     int(2)
  344:     [2]=>
  345:     int(3)
  346:   }
  347:   ["guff"]=>
  348:   NULL
  349: }
  350: 
  351: -- Iteration 40 --
  352: bool(true)
  353: array(2) {
  354:   ["foo"]=>
  355:   array(3) {
  356:     [0]=>
  357:     int(1)
  358:     [1]=>
  359:     int(2)
  360:     [2]=>
  361:     int(3)
  362:   }
  363:   ["guff"]=>
  364:   NULL
  365: }
  366: 
  367: -- Iteration 41 --
  368: bool(true)
  369: array(2) {
  370:   ["foo"]=>
  371:   array(3) {
  372:     [0]=>
  373:     int(1)
  374:     [1]=>
  375:     int(2)
  376:     [2]=>
  377:     int(3)
  378:   }
  379:   ["guff"]=>
  380:   NULL
  381: }
  382: 
  383: -- Iteration 42 --
  384: bool(true)
  385: array(2) {
  386:   ["foo"]=>
  387:   array(3) {
  388:     [0]=>
  389:     int(1)
  390:     [1]=>
  391:     int(2)
  392:     [2]=>
  393:     int(3)
  394:   }
  395:   ["guff"]=>
  396:   NULL
  397: }
  398: 
  399: -- Iteration 43 --
  400: bool(true)
  401: array(2) {
  402:   ["foo"]=>
  403:   &array(3) {
  404:     [0]=>
  405:     int(1)
  406:     [1]=>
  407:     int(2)
  408:     [2]=>
  409:     int(3)
  410:   }
  411:   ["guff"]=>
  412:   &array(3) {
  413:     [0]=>
  414:     int(1)
  415:     [1]=>
  416:     int(2)
  417:     [2]=>
  418:     int(3)
  419:   }
  420: }
  421: 
  422: -- Iteration 44 --
  423: bool(true)
  424: array(2) {
  425:   ["foo"]=>
  426:   &array(3) {
  427:     [0]=>
  428:     int(1)
  429:     [1]=>
  430:     int(2)
  431:     [2]=>
  432:     int(3)
  433:   }
  434:   ["guff"]=>
  435:   &array(3) {
  436:     [0]=>
  437:     int(1)
  438:     [1]=>
  439:     int(2)
  440:     [2]=>
  441:     int(3)
  442:   }
  443: }
  444: 
  445: -- Iteration 45 --
  446: bool(true)
  447: array(2) {
  448:   ["foo"]=>
  449:   &array(3) {
  450:     [0]=>
  451:     int(1)
  452:     [1]=>
  453:     int(2)
  454:     [2]=>
  455:     int(3)
  456:   }
  457:   ["guff"]=>
  458:   &array(3) {
  459:     [0]=>
  460:     int(1)
  461:     [1]=>
  462:     int(2)
  463:     [2]=>
  464:     int(3)
  465:   }
  466: }
  467: 
  468: -- Iteration 46 --
  469: bool(true)
  470: array(2) {
  471:   ["foo"]=>
  472:   &array(3) {
  473:     [0]=>
  474:     int(1)
  475:     [1]=>
  476:     int(2)
  477:     [2]=>
  478:     int(3)
  479:   }
  480:   ["guff"]=>
  481:   &array(3) {
  482:     [0]=>
  483:     int(1)
  484:     [1]=>
  485:     int(2)
  486:     [2]=>
  487:     int(3)
  488:   }
  489: }
  490: 
  491: -- Iteration 47 --
  492: bool(true)
  493: array(2) {
  494:   ["foo"]=>
  495:   &array(3) {
  496:     [0]=>
  497:     int(1)
  498:     [1]=>
  499:     int(2)
  500:     [2]=>
  501:     int(3)
  502:   }
  503:   ["guff"]=>
  504:   &array(3) {
  505:     [0]=>
  506:     int(1)
  507:     [1]=>
  508:     int(2)
  509:     [2]=>
  510:     int(3)
  511:   }
  512: }
  513: 
  514: -- Iteration 48 --
  515: bool(true)
  516: array(3) {
  517:   ["foo"]=>
  518:   &array(3) {
  519:     [0]=>
  520:     int(1)
  521:     [1]=>
  522:     int(2)
  523:     [2]=>
  524:     int(3)
  525:   }
  526:   ["guff"]=>
  527:   &array(3) {
  528:     [0]=>
  529:     int(1)
  530:     [1]=>
  531:     int(2)
  532:     [2]=>
  533:     int(3)
  534:   }
  535:   ["blah"]=>
  536:   NULL
  537: }
  538: 
  539: -- Iteration 49 --
  540: bool(true)
  541: array(3) {
  542:   ["foo"]=>
  543:   &array(3) {
  544:     [0]=>
  545:     int(1)
  546:     [1]=>
  547:     int(2)
  548:     [2]=>
  549:     int(3)
  550:   }
  551:   ["guff"]=>
  552:   &array(3) {
  553:     [0]=>
  554:     int(1)
  555:     [1]=>
  556:     int(2)
  557:     [2]=>
  558:     int(3)
  559:   }
  560:   ["blah"]=>
  561:   NULL
  562: }
  563: 
  564: -- Iteration 50 --
  565: bool(true)
  566: array(3) {
  567:   ["foo"]=>
  568:   &array(3) {
  569:     [0]=>
  570:     int(1)
  571:     [1]=>
  572:     int(2)
  573:     [2]=>
  574:     int(3)
  575:   }
  576:   ["guff"]=>
  577:   &array(3) {
  578:     [0]=>
  579:     int(1)
  580:     [1]=>
  581:     int(2)
  582:     [2]=>
  583:     int(3)
  584:   }
  585:   ["blah"]=>
  586:   NULL
  587: }
  588: 
  589: -- Iteration 51 --
  590: bool(true)
  591: array(3) {
  592:   ["foo"]=>
  593:   &array(3) {
  594:     [0]=>
  595:     int(1)
  596:     [1]=>
  597:     int(2)
  598:     [2]=>
  599:     int(3)
  600:   }
  601:   ["guff"]=>
  602:   &array(3) {
  603:     [0]=>
  604:     int(1)
  605:     [1]=>
  606:     int(2)
  607:     [2]=>
  608:     int(3)
  609:   }
  610:   ["blah"]=>
  611:   NULL
  612: }
  613: bool(true)
  614: Done
  615: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>