- md5
- 50234bf725d1d325e970c7891856eb21
- sha1
- 930505ad87b29eec3ddb2d7a1ce29f508ddcd5d2
- sha256
- cf9428e07b031db9b5c7b24e2f028f8af58ffd811312062913067ce01552ce4c
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
<?php
/**
* @package Joomla.Plugin
* @subpackage System.Debug
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\System\Debug\DataCollector;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Collects info about the request content while redacting potentially secret content
*
* @since 4.2.4
*/
class RequestDataCollector extends \DebugBar\DataCollector\RequestDataCollector
{
/**
* Called by the DebugBar when data needs to be collected
*
* @since 4.2.4
*
* @return array
*/
public function collect()
{
$vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER');
$returnData = array();
foreach ($vars as $var) {
if (isset($GLOBALS[$var])) {
$key = "$" . $var;
$data = $GLOBALS[$var];
array_walk_recursive($data, static function (&$value, $key) {
if (!preg_match(\PlgSystemDebug::PROTECTED_COLLECTOR_KEYS, $key)) {
return;
}
$value = '***redacted***';
});
if ($this->isHtmlVarDumperUsed()) {
$returnData[$key] = $this->getVarDumper()->renderVar($data);
} else {
$returnData[$key] = $this->getDataFormatter()->formatVar($data);
}
}
}
return $returnData;
}
}
The same content is in 6 releases, Joomla 4.2.5-rc1 to 4.3.0-alpha2. See them all, or every version of this file.