<?php
// FILE: protect_vulnerability_improve_code.php
// protect against unplanned information disclosure

// example code file with deliberately written bad code!

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

class BadClass {
	var $test;
	function badClass($test) { $this->test = $test; }
	function getTest() { echo $this->test; }
	function doNothing($test) { $this->test = '888'; }
}

if ($a > $b) echo "A is greater than B\n";

$c = array(1,2,3,4,'S' => 'Should','N' => 'Not', 'M' => 'Mix', 'I' => 'Index Types');

while ($d = next($c)) {
	echo "Array Element: $d\n";
	if ($a == $x) {
		$z = 0;
}

$e = 999;
$f = new BadClass(&$e);
$g = "Open quote ...";
echo $f->getTest();
$f->doNothing(&$e);
echo $e;
