1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
Index: ext/filter/filter.c
===================================================================
--- ext/filter/filter.c	(revision 297780)
+++ ext/filter/filter.c	(working copy)
@@ -537,7 +537,7 @@

 {
 	zval *array_ptr = NULL;
-	zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
+	zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals));

 	switch (arg) {
 		case PARSE_GET:
Index: ext/session/session.c
===================================================================
--- ext/session/session.c	(revision 297780)
+++ ext/session/session.c	(working copy)
@@ -235,8 +235,7 @@
 {
 	zval *session_vars = NULL;

-	/* Unconditionally destroy existing arrays -- possible dirty data */
-	zend_delete_global_variable("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS")-1 TSRMLS_CC);
+	/* Unconditionally destroy existing array -- possible dirty data */
 	zend_delete_global_variable("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);

 	if (PS(http_session_vars)) {
@@ -247,13 +246,7 @@
 	array_init(session_vars);
 	PS(http_session_vars) = session_vars;

-	if (PG(register_long_arrays)) {
-		ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 3, 1);
-		ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 3, 1);
-	}
-	else {
-		ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
-	}
+	ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
 }
 /* }}} */

@@ -1814,9 +1807,7 @@
 	} else {
 		convert_to_string_ex(entry);

-		if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) &&
-			(strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0)
-		) {
+		if (strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0) {
 			PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
 		}
 	}
Index: ext/session/tests/007.phpt
===================================================================
--- ext/session/tests/007.phpt	(revision 297780)
+++ ext/session/tests/007.phpt	(working copy)
@@ -21,39 +21,37 @@
 session_start();
 session_destroy();

-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_register("c");
 unset($c);
 $c = 3.14;
 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);

-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 unset($c);
 $c = 2.78;

 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);

 ### Phase 4 final

 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);

 session_destroy();
 ?>
 --EXPECTF--
 Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0

-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
-
 Deprecated: Function session_register() is deprecated in %s on line %d
 float(3.14)
 array(1) {
Index: ext/session/tests/008-php4.2.3.phpt
===================================================================
--- ext/session/tests/008-php4.2.3.phpt	(revision 297780)
+++ ext/session/tests/008-php4.2.3.phpt	(working copy)
@@ -5,7 +5,6 @@
  if (version_compare(PHP_VERSION,"4.2.3-dev", "<")) die("skip this is for PHP >= 4.2.3");
 ?>
 --INI--
-register_long_arrays=1
 session.use_cookies=0
 session.cache_limiter=
 register_globals=0
@@ -27,7 +26,7 @@
 session_start();
 session_destroy();

-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_register("c");
 var_dump($c);
@@ -36,29 +35,28 @@
 @session_write_close(); // this generates an E_WARNING which will be printed 
 // by $php_errormsg so we can use "@" here. ANY further message IS an error.
 echo $php_errormsg."\n";
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);

-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 unset($c);
 $c = 2.78;

 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);

 ### Phase 4 final

 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);

 session_destroy();
 ?>
 --EXPECTF--
-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
 NULL
 session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively
 array(1) {
Index: ext/session/tests/009.phpt
===================================================================
--- ext/session/tests/009.phpt	(revision 297780)
+++ ext/session/tests/009.phpt	(working copy)
@@ -3,7 +3,6 @@
 --SKIPIF--
 <?php include('skipif.inc'); ?>
 --INI--
-register_long_arrays=1
 session.use_cookies=0
 session.cache_limiter=
 register_globals=0
@@ -21,29 +20,28 @@
 session_start();
 session_destroy();

-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_start();
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 $HTTP_SESSION_VARS["name"] = "foo";
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 session_write_close();

-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($HTTP_SESSION_VARS["name"]);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
+unset($_SESSION["name"]);
+var_dump($_SESSION);
 session_write_close();

 ### Phase 4 final

 session_start();
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 session_destroy();
 ?>
 --EXPECT--
-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
 array(0) {
 }
 array(1) {
Index: main/main.c
===================================================================
--- main/main.c	(revision 297780)
+++ main/main.c	(working copy)
@@ -460,7 +460,6 @@
 	STD_PHP_INI_ENTRY("output_handler",			NULL,		PHP_INI_PERDIR|PHP_INI_SYSTEM,	OnUpdateString,	output_handler,		php_core_globals,	core_globals)
 	STD_PHP_INI_BOOLEAN("register_argc_argv",	"1",		PHP_INI_PERDIR|PHP_INI_SYSTEM,	OnUpdateBool,	register_argc_argv,		php_core_globals,	core_globals)
 	STD_PHP_INI_BOOLEAN("register_globals",		"0",		PHP_INI_PERDIR|PHP_INI_SYSTEM,	OnUpdateBool,	register_globals,		php_core_globals,	core_globals)
-	STD_PHP_INI_BOOLEAN("register_long_arrays",	"1",		PHP_INI_PERDIR|PHP_INI_SYSTEM,	OnUpdateBool,	register_long_arrays,	php_core_globals,	core_globals)
 	STD_PHP_INI_BOOLEAN("auto_globals_jit",		"1",		PHP_INI_PERDIR|PHP_INI_SYSTEM,	OnUpdateBool,	auto_globals_jit,	php_core_globals,	core_globals)
 #if PHP_SAFE_MODE
 	STD_PHP_INI_BOOLEAN("safe_mode",			"1",		PHP_INI_SYSTEM,		OnUpdateBool,			safe_mode,				php_core_globals,	core_globals)
@@ -2061,29 +2060,52 @@
 	/* Check for deprecated directives */
 	/* NOTE: If you add anything here, remember to add it also in Makefile.global! */
 	{
-		static const char *directives[] = {
-			"define_syslog_variables", 
-			"register_globals", 
-			"register_long_arrays", 
-			"safe_mode", 
-			"magic_quotes_gpc", 
-			"magic_quotes_runtime", 
-			"magic_quotes_sybase", 
-			NULL
+		struct dep_directives {
+			const long error_level;
+			const char *phrase;
+			const char *directives[7]; /* Remember to change this if the number of directives change */
 		};
-		const char **p = directives;
-		long val;

-		while (*p) {
-			if (cfg_get_long((char*)*p, &val) == SUCCESS && val) {
-				zend_error(E_WARNING, "Directive '%s' is deprecated in PHP 5.3 and greater", *p);
+		struct dep_directives directives[] = {
+			{
+				E_CORE_WARNING, 
+				"Directive '%s' is deprecated in PHP 5.3 and greater", 
+				{
+					"define_syslog_variables", 
+					"register_globals", 
+					"safe_mode", 
+					"magic_quotes_gpc", 
+					"magic_quotes_runtime", 
+					"magic_quotes_sybase", 
+					NULL
+				}
+			}, 
+			{
+				E_CORE_ERROR, 
+				"Directive '%s' is no longer available in PHP", 
+				{
+					"register_long_arrays", 
+					"zend.ze1_compatibility_mode", 
+					NULL
+				}
 			}
-			++p;
-		}
+		};

-		/* This is not too nice, but since its the only one theres no need for extra stuff here */
-		if (cfg_get_long("zend.ze1_compatibility_mode", &val) == SUCCESS && val) {
-			zend_error(E_ERROR, "zend.ze1_compatibility_mode is no longer supported in PHP 5.3 and greater");
+		unsigned int i;
+
+		/* 2 = Count of deprecation structs */
+		for (i = 0; i < 2; i++) {
+			const char **p = directives[i].directives;
+
+			while(*p) {
+				long value;
+
+				if (cfg_get_long((char*)*p, &value) == SUCCESS && value) {
+					zend_error(directives[i].error_level, directives[i].phrase, *p);
+				}
+
+				++p;
+			}
 		}
 	}
 	
Index: main/php_globals.h
===================================================================
--- main/php_globals.h	(revision 297780)
+++ main/php_globals.h	(working copy)
@@ -123,7 +123,6 @@
 	zend_bool expose_php;

 	zend_bool register_globals;
-	zend_bool register_long_arrays;
 	zend_bool register_argc_argv;
 	zend_bool auto_globals_jit;

Index: main/php_variables.c
===================================================================
--- main/php_variables.c	(revision 297780)
+++ main/php_variables.c	(working copy)
@@ -653,20 +653,18 @@
 {
 	char *p;
 	unsigned char _gpc_flags[5] = {0, 0, 0, 0, 0};
-	zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
+	zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals));
 	struct auto_global_record {
 		char *name;
 		uint name_len;
-		char *long_name;
-		uint long_name_len;
 		zend_bool jit_initialization;
 	} auto_global_records[] = {
-		{ "_POST", sizeof("_POST"), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), 0 },
-		{ "_GET", sizeof("_GET"), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), 0 },
-		{ "_COOKIE", sizeof("_COOKIE"), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), 0 },
-		{ "_SERVER", sizeof("_SERVER"), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), 1 },
-		{ "_ENV", sizeof("_ENV"), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), 1 },
-		{ "_FILES", sizeof("_FILES"), "HTTP_POST_FILES", sizeof("HTTP_POST_FILES"), 0 },
+		{ "_POST", sizeof("_POST"), 0 },
+		{ "_GET", sizeof("_GET"), 0 },
+		{ "_COOKIE", sizeof("_COOKIE"), 0 },
+		{ "_SERVER", sizeof("_SERVER"), 1 },
+		{ "_ENV", sizeof("_ENV"), 1 },
+		{ "_FILES", sizeof("_FILES"), 0 },
 	};
 	size_t num_track_vars = sizeof(auto_global_records)/sizeof(struct auto_global_record);
 	size_t i;
@@ -750,10 +748,6 @@

 		Z_ADDREF_P(PG(http_globals)[i]);
 		zend_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
-		if (PG(register_long_arrays)) {
-			zend_hash_update(&EG(symbol_table), auto_global_records[i].long_name, auto_global_records[i].long_name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
-			Z_ADDREF_P(PG(http_globals)[i]);
-		}
 	}

 	/* Create _REQUEST */
@@ -801,11 +795,6 @@
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
 	Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);

-	if (PG(register_long_arrays)) {
-		zend_hash_update(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
-		Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
-	}
-	
 	return 0; /* don't rearm */
 }

@@ -827,11 +816,6 @@
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
 	Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);

-	if (PG(register_long_arrays)) {
-		zend_hash_update(&EG(symbol_table), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
-		Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
-	}
-
 	return 0; /* don't rearm */
 }

Index: Makefile.global
===================================================================
--- Makefile.global	(revision 297780)
+++ Makefile.global	(working copy)
@@ -79,7 +79,7 @@
 			. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
 		done; \
 	fi`
-PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_(globals|long_arrays)?|safe_mode|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
+PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_globals|safe_mode|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='

 test: all
 	-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
Index: php.ini-development
===================================================================
--- php.ini-development	(revision 297780)
+++ php.ini-development	(working copy)
@@ -141,11 +141,6 @@
 ;   Development Value: Off
 ;   Production Value: Off

-; register_long_arrays
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; request_order
 ;   Default Value: None
 ;   Development Value: "GP"
@@ -690,16 +685,6 @@
 ; http://php.net/register-globals
 register_globals = Off

-; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
-; are registered by PHP or not. As they are deprecated, we obviously don't
-; recommend you use them. They are on by default for compatibility reasons but
-; they are not recommended on production servers.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/register-long-arrays
-register_long_arrays = Off
-
 ; This directive determines whether PHP registers $argv & $argc each time it
 ; runs. $argv contains an array of all the arguments passed to PHP when a script
 ; is invoked. $argc contains an integer representing the number of arguments
@@ -718,8 +703,8 @@
 ; When enabled, the SERVER and ENV variables are created when they're first
 ; used (Just In Time) instead of when the script starts. If these variables
 ; are not used within a script, having this directive on will result in a
-; performance gain. The PHP directives register_globals, register_long_arrays,
-; and register_argc_argv must be disabled for this directive to have any affect.
+; performance gain. The PHP directives register_globals and register_argc_argv 
+; must be disabled for this directive to have any affect.
 ; http://php.net/auto-globals-jit
 auto_globals_jit = On

Index: php.ini-production
===================================================================
--- php.ini-production	(revision 297780)
+++ php.ini-production	(working copy)
@@ -141,11 +141,6 @@
 ;   Development Value: Off
 ;   Production Value: Off

-; register_long_arrays
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; request_order
 ;   Default Value: None
 ;   Development Value: "GP"
@@ -690,16 +685,6 @@
 ; http://php.net/register-globals
 register_globals = Off

-; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
-; are registered by PHP or not. As they are deprecated, we obviously don't
-; recommend you use them. They are on by default for compatibility reasons but
-; they are not recommended on production servers.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/register-long-arrays
-register_long_arrays = Off
-
 ; This directive determines whether PHP registers $argv & $argc each time it
 ; runs. $argv contains an array of all the arguments passed to PHP when a script
 ; is invoked. $argc contains an integer representing the number of arguments
@@ -718,8 +703,8 @@
 ; When enabled, the SERVER and ENV variables are created when they're first
 ; used (Just In Time) instead of when the script starts. If these variables
 ; are not used within a script, having this directive on will result in a
-; performance gain. The PHP directives register_globals, register_long_arrays,
-; and register_argc_argv must be disabled for this directive to have any affect.
+; performance gain. The PHP directives register_globals and register_argc_argv 
+; must be disabled for this directive to have any affect.
 ; http://php.net/auto-globals-jit
 auto_globals_jit = On

Index: Zend/tests/unset_cv05.phpt
===================================================================
--- Zend/tests/unset_cv05.phpt	(revision 297780)
+++ Zend/tests/unset_cv05.phpt	(working copy)
@@ -1,7 +1,6 @@
 --TEST--
 unset() CV 5 (indirect unset() of global variable in session_start())
 --INI--
-register_long_arrays=1
 session.auto_start=0
 session.save_handler=files
 --SKIPIF--
@@ -12,14 +11,13 @@
 ?>
 --FILE--
 <?php
-$HTTP_SESSION_VARS = "ok\n";
-echo $HTTP_SESSION_VARS;
+$_SESSION = "ok\n";
+echo $_SESSION;
 session_start();
-echo $HTTP_SESSION_VARS;
+echo $_SESSION;
 echo "\nok\n";
 ?>
 --EXPECTF--
-Warning: Directive 'register_long_arrays' is deprecated in PHP %d.%d and greater in Unknown on line 0
 ok

 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d