1--TEST-- 2Test session_register() function : variation 3--SKIPIF-- 4<?php include('skipif.inc'); ?> 5--FILE-- 6<?php 7 8ob_start(); 9 10/* 11 * Prototype : bool session_register(mixed $name [,mixed $...]) 12 * Description : Register one or more global variables with the current session 13 * Source code : ext/session/session.c 14 */ 15 16echo "*** Testing session_register() : variation ***\n"; 17 18// Get an unset variable 19$unset_var = 10; 20unset($unset_var); 21 22class classA 23{ 24 public function __toString() { 25 return "Hello World!"; 26 } 27} 28 29$heredoc = <<<EOT 30Hello World! 31EOT; 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 83var_dump(session_start()); 84var_dump($_SESSION); 85var_dump(session_register($inputs)); 86var_dump($_SESSION); 87var_dump(session_destroy()); 88var_dump($_SESSION); 89 90fclose($fp); 91echo "Done"; 92ob_end_flush(); 93?> 94--EXPECTF-- 95*** Testing session_register() : variation *** 96bool(true) 97array(0) { 98} 99 100Deprecated: Function session_register() is deprecated in %s on line %d 101bool(true) 102array(13) { 103 ["0"]=> 104 NULL 105 ["1"]=> 106 NULL 107 ["12345"]=> 108 NULL 109 ["-2345"]=> 110 NULL 111 ["10.5"]=> 112 NULL 113 ["-10.5"]=> 114 NULL 115 ["123456789000"]=> 116 NULL 117 ["1.23456789E-9"]=> 118 NULL 119 ["0.5"]=> 120 NULL 121 [""]=> 122 NULL 123 ["Nothing"]=> 124 NULL 125 ["Hello World!"]=> 126 NULL 127 ["Resource id #%d"]=> 128 NULL 129} 130bool(true) 131array(13) { 132 ["0"]=> 133 NULL 134 ["1"]=> 135 NULL 136 ["12345"]=> 137 NULL 138 ["-2345"]=> 139 NULL 140 ["10.5"]=> 141 NULL 142 ["-10.5"]=> 143 NULL 144 ["123456789000"]=> 145 NULL 146 ["1.23456789E-9"]=> 147 NULL 148 ["0.5"]=> 149 NULL 150 [""]=> 151 NULL 152 ["Nothing"]=> 153 NULL 154 ["Hello World!"]=> 155 NULL 156 ["Resource id #%d"]=> 157 NULL 158} 159Done 160