File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / session_start_error.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, 4 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_start() function : error functionality
    3: --SKIPIF--
    4: <?php include('skipif.inc'); ?>
    5: --FILE--
    6: <?php
    7: 
    8: ob_start();
    9: 
   10: /* 
   11:  * Prototype : bool session_start(void)
   12:  * Description : Initialize session data
   13:  * Source code : ext/session/session.c 
   14:  */
   15: 
   16: echo "*** Testing session_start() : error functionality ***\n";
   17: 
   18: // Get an unset variable
   19: $unset_var = 10;
   20: unset($unset_var);
   21: 
   22: class classA
   23: {
   24:     public function __toString() {
   25:         return "Hello World!";
   26:     }
   27: }
   28: 
   29: $heredoc = <<<EOT
   30: Hello World!
   31: EOT;
   32: 
   33: $fp = fopen(__FILE__, "r");
   34: 
   35: // Unexpected values to be passed as arguments
   36: $inputs = array(
   37: 
   38:        // Integer data
   39: /*1*/  0,
   40:        1,
   41:        12345,
   42:        -2345,
   43: 
   44:        // Float data
   45: /*5*/  10.5,
   46:        -10.5,
   47:        12.3456789000e10,
   48:        12.3456789000E-10,
   49:        .5,
   50: 
   51:        // Null data
   52: /*10*/ NULL,
   53:        null,
   54: 
   55:        // Boolean data
   56: /*12*/ true,
   57:        false,
   58:        TRUE,
   59:        FALSE,
   60:        
   61:        // Empty strings
   62: /*16*/ "",
   63:        '',
   64: 
   65:        // Invalid string data
   66: /*18*/ "Nothing",
   67:        'Nothing',
   68:        $heredoc,
   69:        
   70:        // Object data
   71: /*21*/ new classA(),
   72: 
   73:        // Undefined data
   74: /*22*/ @$undefined_var,
   75: 
   76:        // Unset data
   77: /*23*/ @$unset_var,
   78: 
   79:        // Resource variable
   80: /*24*/ $fp
   81: );
   82: 
   83: 
   84: $iterator = 1;
   85: foreach($inputs as $input) {
   86:     echo "\n-- Iteration $iterator --\n";
   87:     var_dump(session_start($input));
   88:     var_dump(session_destroy());
   89:     $iterator++;
   90: };
   91: 
   92: fclose($fp);
   93: echo "Done";
   94: ob_end_flush();
   95: ?>
   96: --EXPECTF--
   97: *** Testing session_start() : error functionality ***
   98: 
   99: -- Iteration 1 --
  100: bool(true)
  101: bool(true)
  102: 
  103: -- Iteration 2 --
  104: bool(true)
  105: bool(true)
  106: 
  107: -- Iteration 3 --
  108: bool(true)
  109: bool(true)
  110: 
  111: -- Iteration 4 --
  112: bool(true)
  113: bool(true)
  114: 
  115: -- Iteration 5 --
  116: bool(true)
  117: bool(true)
  118: 
  119: -- Iteration 6 --
  120: bool(true)
  121: bool(true)
  122: 
  123: -- Iteration 7 --
  124: bool(true)
  125: bool(true)
  126: 
  127: -- Iteration 8 --
  128: bool(true)
  129: bool(true)
  130: 
  131: -- Iteration 9 --
  132: bool(true)
  133: bool(true)
  134: 
  135: -- Iteration 10 --
  136: bool(true)
  137: bool(true)
  138: 
  139: -- Iteration 11 --
  140: bool(true)
  141: bool(true)
  142: 
  143: -- Iteration 12 --
  144: bool(true)
  145: bool(true)
  146: 
  147: -- Iteration 13 --
  148: bool(true)
  149: bool(true)
  150: 
  151: -- Iteration 14 --
  152: bool(true)
  153: bool(true)
  154: 
  155: -- Iteration 15 --
  156: bool(true)
  157: bool(true)
  158: 
  159: -- Iteration 16 --
  160: bool(true)
  161: bool(true)
  162: 
  163: -- Iteration 17 --
  164: bool(true)
  165: bool(true)
  166: 
  167: -- Iteration 18 --
  168: bool(true)
  169: bool(true)
  170: 
  171: -- Iteration 19 --
  172: bool(true)
  173: bool(true)
  174: 
  175: -- Iteration 20 --
  176: bool(true)
  177: bool(true)
  178: 
  179: -- Iteration 21 --
  180: bool(true)
  181: bool(true)
  182: 
  183: -- Iteration 22 --
  184: bool(true)
  185: bool(true)
  186: 
  187: -- Iteration 23 --
  188: bool(true)
  189: bool(true)
  190: 
  191: -- Iteration 24 --
  192: bool(true)
  193: bool(true)
  194: Done
  195: 

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