joomla/joomla-cms — pull request #4409 by garima-agal (2014-09-30 20:55:55+00:00)
Title: fix in table related to defining protected variable with underscore

Protected variable is not defined with starting as '_'(underscore), so it is not filtering out afterwards in getPropeties function and creating fatal error issue that trying to access protected function.
For example. If we call getProperties function on Jtable and apply loop on that, then jsonEncode variable also comes in that. And thus causing fatal error

$vars = $this->getTable()->getProperties(); // $this->getTable gives the instance of desired table which is extended with Jtable. $vars contain $jsonEncode variable also.
$retObj = new stdClass();

$table = $this->getTable();
$table->load(null);

foreach($vars as $key => $value) {

$retObj->$key = $table->$key;
}