File: GetRequestDataUnitTest.inc

package info (click to toggle)
php-codesniffer 1.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,092 kB
  • sloc: php: 30,445; xml: 3,768; makefile: 15; pascal: 8; sh: 6
file content (30 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (7)
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
<?php
echo $_REQUEST['action'];
Security::getRequestData('action');

echo $_POST['action'];
Security::getRequestData('action', 'post');

echo $_GET[$action];
Security::getRequestData($action, 'get');

class Security
{
    function getRequestData($var) {
        echo $_REQUEST[$var];
    }
}

class Insecurity
{
    function getRequestData($var) {
        unset($_REQUEST[$var]);
        echo 'OMGHAX!';
    }
}

$sample = Util::getArrayIndex($_REQUEST, 'sample', '');
$syntax = Util::getArrayIndex($_REQUEST, 'syntax', '');
$value  = Util::getArrayIndex($_FILES, $key, $default);

?>