5 changed files with 350 additions and 10 deletions
-
19ext/standard/basic_functions.c
-
97ext/standard/php_var.h
-
180ext/standard/tests/general_functions/import_request1.phpt
-
32ext/standard/tests/general_functions/import_request2.phpt
-
32ext/standard/tests/general_functions/import_request3.phpt
@ -0,0 +1,180 @@ |
|||
--TEST-- |
|||
import_request_variables() test (overwrite super-globals) |
|||
--GET-- |
|||
GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4 |
|||
--POST-- |
|||
GET=5&POST=6&COOKIE=7&FILES=8&REQUEST=9 |
|||
--COOKIE-- |
|||
GET=10;POST=11;COOKIE=12;FILES=13;REQUEST=14 |
|||
--INI-- |
|||
variables_order=CGP |
|||
--FILE-- |
|||
<?php |
|||
|
|||
import_request_variables("gpc", "_"); |
|||
var_dump($_GET, $_POST, $_COOKIE, $_FILES, $_REQUEST); |
|||
|
|||
echo "Done\n"; |
|||
?> |
|||
--EXPECTF-- |
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
array(5) { |
|||
["GET"]=> |
|||
string(1) "0" |
|||
["POST"]=> |
|||
string(1) "1" |
|||
["COOKIE"]=> |
|||
string(1) "2" |
|||
["FILES"]=> |
|||
string(1) "3" |
|||
["REQUEST"]=> |
|||
string(1) "4" |
|||
} |
|||
array(5) { |
|||
["GET"]=> |
|||
string(1) "5" |
|||
["POST"]=> |
|||
string(1) "6" |
|||
["COOKIE"]=> |
|||
string(1) "7" |
|||
["FILES"]=> |
|||
string(1) "8" |
|||
["REQUEST"]=> |
|||
string(1) "9" |
|||
} |
|||
array(5) { |
|||
["GET"]=> |
|||
string(2) "10" |
|||
["POST"]=> |
|||
string(2) "11" |
|||
["COOKIE"]=> |
|||
string(2) "12" |
|||
["FILES"]=> |
|||
string(2) "13" |
|||
["REQUEST"]=> |
|||
string(2) "14" |
|||
} |
|||
array(0) { |
|||
} |
|||
array(5) { |
|||
["GET"]=> |
|||
string(1) "5" |
|||
["POST"]=> |
|||
string(1) "6" |
|||
["COOKIE"]=> |
|||
string(1) "7" |
|||
["FILES"]=> |
|||
string(1) "8" |
|||
["REQUEST"]=> |
|||
string(1) "9" |
|||
} |
|||
Done |
|||
--UEXPECTF-- |
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d |
|||
|
|||
Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d |
|||
array(5) { |
|||
[u"GET"]=> |
|||
unicode(1) "0" |
|||
[u"POST"]=> |
|||
unicode(1) "1" |
|||
[u"COOKIE"]=> |
|||
unicode(1) "2" |
|||
[u"FILES"]=> |
|||
unicode(1) "3" |
|||
[u"REQUEST"]=> |
|||
unicode(1) "4" |
|||
} |
|||
array(5) { |
|||
[u"GET"]=> |
|||
unicode(1) "5" |
|||
[u"POST"]=> |
|||
unicode(1) "6" |
|||
[u"COOKIE"]=> |
|||
unicode(1) "7" |
|||
[u"FILES"]=> |
|||
unicode(1) "8" |
|||
[u"REQUEST"]=> |
|||
unicode(1) "9" |
|||
} |
|||
array(5) { |
|||
[u"GET"]=> |
|||
unicode(2) "10" |
|||
[u"POST"]=> |
|||
unicode(2) "11" |
|||
[u"COOKIE"]=> |
|||
unicode(2) "12" |
|||
[u"FILES"]=> |
|||
unicode(2) "13" |
|||
[u"REQUEST"]=> |
|||
unicode(2) "14" |
|||
} |
|||
array(0) { |
|||
} |
|||
array(5) { |
|||
[u"GET"]=> |
|||
unicode(1) "5" |
|||
[u"POST"]=> |
|||
unicode(1) "6" |
|||
[u"COOKIE"]=> |
|||
unicode(1) "7" |
|||
[u"FILES"]=> |
|||
unicode(1) "8" |
|||
[u"REQUEST"]=> |
|||
unicode(1) "9" |
|||
} |
|||
Done |
|||
@ -0,0 +1,32 @@ |
|||
--TEST-- |
|||
import_request_variables() test (numeric keys) |
|||
--GET-- |
|||
1=0&2=1&3=2&4=3&5=4 |
|||
--POST-- |
|||
1=5&2=6&3=7&4=8&5=9 |
|||
--COOKIE-- |
|||
1=10;2=11;3=12;4=13;5=14 |
|||
--INI-- |
|||
variables_order=CGP |
|||
--FILE-- |
|||
<?php |
|||
|
|||
import_request_variables("gpc", "_"); |
|||
var_dump($_1, $_2, $_3, $_4, $_5); |
|||
|
|||
echo "Done\n"; |
|||
?> |
|||
--EXPECTF-- |
|||
string(2) "10" |
|||
string(2) "11" |
|||
string(2) "12" |
|||
string(2) "13" |
|||
string(2) "14" |
|||
Done |
|||
--UEXPECTF-- |
|||
unicode(2) "10" |
|||
unicode(2) "11" |
|||
unicode(2) "12" |
|||
unicode(2) "13" |
|||
unicode(2) "14" |
|||
Done |
|||
@ -0,0 +1,32 @@ |
|||
--TEST-- |
|||
import_request_variables() test (numeric keys, different order) |
|||
--GET-- |
|||
1=0&2=1&3=2&4=3&5=4 |
|||
--POST-- |
|||
1=5&2=6&3=7&4=8&5=9 |
|||
--COOKIE-- |
|||
1=10;2=11;3=12;4=13;5=14 |
|||
--INI-- |
|||
variables_order=CGP |
|||
--FILE-- |
|||
<?php |
|||
|
|||
import_request_variables("gcp", "_"); |
|||
var_dump($_1, $_2, $_3, $_4, $_5); |
|||
|
|||
echo "Done\n"; |
|||
?> |
|||
--EXPECTF-- |
|||
string(1) "5" |
|||
string(1) "6" |
|||
string(1) "7" |
|||
string(1) "8" |
|||
string(1) "9" |
|||
Done |
|||
--UEXPECTF-- |
|||
unicode(1) "5" |
|||
unicode(1) "6" |
|||
unicode(1) "7" |
|||
unicode(1) "8" |
|||
unicode(1) "9" |
|||
Done |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue