Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ parameters:
Controller:
- HTTP
- Validation
Cookie:
- I18n
Database:
- Entity
- Events
Expand Down
9 changes: 5 additions & 4 deletions system/Cookie/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use ArrayAccess;
use CodeIgniter\Cookie\Exceptions\CookieException;
use CodeIgniter\I18n\Time;
use Config\Cookie as CookieConfig;
use DateTimeInterface;
use InvalidArgumentException;
Expand Down Expand Up @@ -206,7 +207,7 @@ final public function __construct(string $name, string $value = '', array $optio

// If both `Expires` and `Max-Age` are set, `Max-Age` has precedence.
if (isset($options['max-age']) && is_numeric($options['max-age'])) {
$options['expires'] = time() + (int) $options['max-age'];
$options['expires'] = Time::now()->getTimestamp() + (int) $options['max-age'];
unset($options['max-age']);
}

Expand Down Expand Up @@ -314,15 +315,15 @@ public function getExpiresString(): string
*/
public function isExpired(): bool
{
return $this->expires === 0 || $this->expires < time();
return $this->expires === 0 || $this->expires < Time::now()->getTimestamp();
}

/**
* {@inheritDoc}
*/
public function getMaxAge(): int
{
$maxAge = $this->expires - time();
$maxAge = $this->expires - Time::now()->getTimestamp();

return $maxAge >= 0 ? $maxAge : 0;
}
Expand Down Expand Up @@ -466,7 +467,7 @@ public function withNeverExpiring()
{
$cookie = clone $this;

$cookie->expires = time() + 5 * YEAR;
$cookie->expires = Time::now()->getTimestamp() + 5 * YEAR;

return $cookie;
}
Expand Down
3 changes: 2 additions & 1 deletion system/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
use Config\Services;
use Config\Toolbar as ToolbarConfig;
use Kint\Kint;
Expand Down Expand Up @@ -380,7 +381,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
helper('filesystem');

// Updated to microtime() so we can get history
$time = sprintf('%.6f', microtime(true));
$time = sprintf('%.6f', Time::now()->format('U.u'));

if (! is_dir(WRITEPATH . 'debugbar')) {
mkdir(WRITEPATH . 'debugbar', 0777);
Expand Down
3 changes: 2 additions & 1 deletion system/Debug/Toolbar/Collectors/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace CodeIgniter\Debug\Toolbar\Collectors;

use CodeIgniter\Database\Query;
use CodeIgniter\I18n\Time;

/**
* Collector for the Database tab of the Debug Toolbar.
Expand Down Expand Up @@ -184,7 +185,7 @@ public function display(): array
'sql' => $query['query']->debugToolbarDisplay(),
'trace' => $query['trace'],
'trace-file' => $firstNonSystemLine,
'qid' => md5($query['query'] . microtime()),
'qid' => md5($query['query'] . Time::now()->format('0.u00 U')),
];
}, static::$queries);

Expand Down