This utilizes a singleton pattern to get around scoping issues
public static makePostCage ( string $config_file = null, boolean $strict = true ) : |
||
$config_file | string | |
$strict | boolean | whether or not to nullify the superglobal array |
return |
/** * second level of scoping * */ function testScoping2() { $cage_POST = Inspekt::makePostCage(); echo "<pre>In " . __FUNCTION__ . "(): "; var_dump($cage_POST->testAlnum('/funky,_+=_\\|;:!@#$%^&*~time/0/0/`~foo,.+=_\\|;:!@#$%^&*~-bar')); echo "</pre>\n"; echo "<pre>POST is not accessible here: "; var_dump($_POST); echo "</pre>\n"; }
/** * */ public function testMakePostCage() { $cage = Inspekt::makePostCage(); $this->assertTrue($cage instanceof Cage); }
/** * */ public function testTestAlnum3() { $_POST = array(); $_POST['b'] = '0'; $cage_POST = Inspekt::makePostCage(); $result = $cage_POST->testLessThan('b', 25); $this->assertSame('0', $result); }