1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 05:18:32 +01:00

Check parameters for binary data

For example when saving an image as a Blob in the DB.
This commit is contained in:
Barry vd. Heuvel 2013-11-04 21:51:32 +01:00
parent 71be65fdcd
commit a8aabe817e

View File

@ -51,7 +51,7 @@ class TracedStatement
{
$this->sql = $sql;
$this->rowCount = $rowCount;
$this->parameters = $params;
$this->parameters = $this->checkParameters($params);
$this->preparedId = $preparedId;
$this->startTime = $startTime;
$this->endTime = $endTime;
@ -59,6 +59,21 @@ class TracedStatement
$this->memoryUsage = $memoryUsage;
$this->exception = $e;
}
/**
* Check parameters for illegal (non UTF-8) strings, like Binary data.
*
* @param $params
* @return mixed
*/
public function checkParameters($params){
foreach($params as &$param){
if(!mb_check_encoding($param, 'UTF-8')){
$param = '[BINARY DATA]';
}
}
return $params;
}
/**
* Returns the SQL string used for the query