1--TEST--
2Test set_magic_quotes_runtime() function -  usage variation
3--INI--
4magic_quotes_runtime = 0
5--FILE--
6<?php
7/* Prototype: bool set_magic_quotes_runtime  ( int $new_setting  )
8 * Description: Sets the current active configuration setting of magic_quotes_runtime
9*/
10
11echo "Simple testcase for set_magic_quotes_runtime() function\n";
12
13$g = get_magic_quotes_runtime();
14echo "magic quotes runtime set in INI file: ".$g."\n";
15
16// Prevent notices about undefines variables
17error_reporting(E_ALL & ~E_NOTICE);
18
19$unset_var = 10;
20unset ($unset_var);
21
22class fooClass {
23   function __toString() {
24       return "true";
25   }
26}
27
28$fp = fopen(__FILE__, "r");
29
30$values = array(
31
32	      // int data
33/*1*/     0,
34	      1,
35	      12345,
36	      -2345,
37
38	      // float data
39/*5*/     0.0,
40	      10.5,
41	      -10.5,
42	      10.1234567e10,
43	      10.7654321E-10,
44	      .5,
45
46	      // null data
47/*11*/    NULL,
48	      null,
49
50	      // boolean data
51/*13*/    true,
52	      false,
53	      TRUE,
54	      FALSE,
55
56	      // empty data
57/*17*/    "",
58	      '',
59
60	      // object data
61/*19*/    new fooClass(),
62
63	      // resource
64/*20*/    $fp,
65
66	      // undefined data
67/*21*/    $undefined_var,
68
69	      // unset data
70/*22*/    $unset_var
71);
72
73// loop through each element of the array for data
74
75$iterator = 1;
76foreach($values as $value) {
77      echo "-- Iterator $iterator --\n";
78      var_dump( set_magic_quotes_runtime($value) );
79      echo "New value of magic_quotes_runtime after last set is " . get_magic_quotes_runtime(). "\n";
80      $iterator++;
81};
82
83fclose($fp);
84
85?>
86===DONE===
87--EXPECTF--
88Simple testcase for set_magic_quotes_runtime() function
89magic quotes runtime set in INI file: 0
90-- Iterator 1 --
91
92Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
93bool(true)
94New value of magic_quotes_runtime after last set is 0
95-- Iterator 2 --
96
97Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
98bool(true)
99New value of magic_quotes_runtime after last set is 1
100-- Iterator 3 --
101
102Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
103bool(true)
104New value of magic_quotes_runtime after last set is 1
105-- Iterator 4 --
106
107Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
108bool(true)
109New value of magic_quotes_runtime after last set is 1
110-- Iterator 5 --
111
112Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
113bool(true)
114New value of magic_quotes_runtime after last set is 0
115-- Iterator 6 --
116
117Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
118bool(true)
119New value of magic_quotes_runtime after last set is 1
120-- Iterator 7 --
121
122Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
123bool(true)
124New value of magic_quotes_runtime after last set is 1
125-- Iterator 8 --
126
127Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
128bool(true)
129New value of magic_quotes_runtime after last set is 1
130-- Iterator 9 --
131
132Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
133bool(true)
134New value of magic_quotes_runtime after last set is 1
135-- Iterator 10 --
136
137Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
138bool(true)
139New value of magic_quotes_runtime after last set is 1
140-- Iterator 11 --
141
142Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
143bool(true)
144New value of magic_quotes_runtime after last set is 0
145-- Iterator 12 --
146
147Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
148bool(true)
149New value of magic_quotes_runtime after last set is 0
150-- Iterator 13 --
151
152Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
153bool(true)
154New value of magic_quotes_runtime after last set is 1
155-- Iterator 14 --
156
157Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
158bool(true)
159New value of magic_quotes_runtime after last set is 0
160-- Iterator 15 --
161
162Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
163bool(true)
164New value of magic_quotes_runtime after last set is 1
165-- Iterator 16 --
166
167Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
168bool(true)
169New value of magic_quotes_runtime after last set is 0
170-- Iterator 17 --
171
172Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
173bool(true)
174New value of magic_quotes_runtime after last set is 0
175-- Iterator 18 --
176
177Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
178bool(true)
179New value of magic_quotes_runtime after last set is 0
180-- Iterator 19 --
181
182Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
183
184Warning: set_magic_quotes_runtime() expects parameter 1 to be boolean, object given in %s on line %d
185NULL
186New value of magic_quotes_runtime after last set is 0
187-- Iterator 20 --
188
189Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
190
191Warning: set_magic_quotes_runtime() expects parameter 1 to be boolean, resource given in %s on line %d
192NULL
193New value of magic_quotes_runtime after last set is 0
194-- Iterator 21 --
195
196Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
197bool(true)
198New value of magic_quotes_runtime after last set is 0
199-- Iterator 22 --
200
201Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
202bool(true)
203New value of magic_quotes_runtime after last set is 0
204===DONE===
205