* [FIX] Fixed wrong behavior when analyzing an array from a request.

* [ADD] Added SQL logging when debug is enabled.
This commit is contained in:
nuxsmin
2018-07-12 01:24:52 +02:00
parent 1cccd52c85
commit 5ea930c0bc
3 changed files with 9 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ use SP\Core\Context\ContextInterface;
use SP\Core\Events\EventDispatcher;
use SP\Http\Request;
use SP\Providers\Log\DatabaseLogHandler;
use SP\Providers\Log\FileLogHandler;
use SP\Providers\Log\RemoteSyslogHandler;
use SP\Providers\Log\SyslogHandler;
use SP\Providers\Mail\MailHandler;
@@ -128,7 +129,9 @@ abstract class ModuleBase
if ($this->configData->isLogEnabled()) {
$eventDispatcher->attach($this->container->get(DatabaseLogHandler::class));
// $eventDispatcher->attach($this->container->get(FileLogHandler::class));
if (DEBUG) {
$eventDispatcher->attach($this->container->get(FileLogHandler::class));
}
}
if ($this->configData->isMailEnabled()) {

View File

@@ -336,7 +336,7 @@ class Request
}
return array_map(function ($value) {
return is_numeric($value) ? $this->analyzeInt($value) : $this->analyzeString($value);
return is_numeric($value) ? Filter::getInt($value) : Filter::getString($value);
}, $this->params->get($param));
}

View File

@@ -179,7 +179,10 @@ class Database implements DatabaseInterface
$stmt = $this->prepareQueryData($queryData);
$this->eventDispatcher->notifyEvent('database.query',
new Event($this, EventMessage::factory()->addDescription($queryData->getQuery())));
new Event($this, EventMessage::factory()
->addDescription($queryData->getQuery())
)
);
if (preg_match("/^(select|show)\s/i", $queryData->getQuery())) {
$this->numFields = $stmt->columnCount();