update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -260,7 +260,7 @@ public function prepare(Request $request): static
if ($start < 0 || $start > $end) {
$this->setStatusCode(416);
$this->headers->set('Content-Range', \sprintf('bytes */%s', $fileSize));
} elseif ($end - $start < $fileSize - 1) {
} else {
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
$this->offset = $start;

View File

@@ -184,22 +184,30 @@ public function move(string $directory, ?string $name = null): File
switch ($this->error) {
case \UPLOAD_ERR_INI_SIZE:
throw new IniSizeFileException($this->getErrorMessage());
throw new IniSizeFileException($this->getExceptionMessage());
case \UPLOAD_ERR_FORM_SIZE:
throw new FormSizeFileException($this->getErrorMessage());
throw new FormSizeFileException($this->getExceptionMessage());
case \UPLOAD_ERR_PARTIAL:
throw new PartialFileException($this->getErrorMessage());
throw new PartialFileException($this->getExceptionMessage());
case \UPLOAD_ERR_NO_FILE:
throw new NoFileException($this->getErrorMessage());
throw new NoFileException($this->getExceptionMessage());
case \UPLOAD_ERR_CANT_WRITE:
throw new CannotWriteFileException($this->getErrorMessage());
throw new CannotWriteFileException($this->getExceptionMessage());
case \UPLOAD_ERR_NO_TMP_DIR:
throw new NoTmpDirFileException($this->getErrorMessage());
throw new NoTmpDirFileException($this->getExceptionMessage());
case \UPLOAD_ERR_EXTENSION:
throw new ExtensionFileException($this->getErrorMessage());
throw new ExtensionFileException($this->getExceptionMessage());
}
throw new FileException($this->getErrorMessage());
throw new FileException($this->getExceptionMessage());
}
/**
* Retrieves a user-friendly error message for file upload issues, if any.
*/
public function getErrorMessage(): string
{
return \UPLOAD_ERR_OK !== $this->error ? $this->getExceptionMessage() : '';
}
/**
@@ -248,7 +256,7 @@ private static function parseFilesize(string $size): int|float
/**
* Returns an informative upload error message.
*/
public function getErrorMessage(): string
private function getExceptionMessage(): string
{
static $errors = [
\UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',

View File

@@ -404,8 +404,16 @@ public static function create(string $uri, string $method = 'GET', array $parame
$server['PHP_AUTH_PW'] = $components['pass'];
}
if (!isset($components['path'])) {
if ('' === $path = $components['path'] ?? '') {
$components['path'] = '/';
} elseif (!isset($components['scheme']) && !isset($components['host']) && '/' !== $path[0]) {
if (false !== $pos = strpos($path, '/')) {
$path = substr($path, 0, $pos);
}
if (str_contains($path, ':')) {
throw new BadRequestException('Invalid URI: Path is malformed.');
}
}
switch (strtoupper($method)) {

View File

@@ -72,6 +72,16 @@ public function read(#[\SensitiveParameter] string $sessionId): string
return $data;
}
public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool
{
$this->igbinaryEmptyData ??= \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
if ('' === $data || $this->igbinaryEmptyData === $data) {
return $this->destroy($sessionId);
}
return true;
}
public function write(#[\SensitiveParameter] string $sessionId, string $data): bool
{
// see https://github.com/igbinary/igbinary/issues/146

View File

@@ -194,7 +194,6 @@ public function configureSchema(Schema $schema, ?\Closure $isSameDatabase = null
$table->addColumn($this->dataCol, Types::BLOB)->setNotnull(true);
$table->addColumn($this->lifetimeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true);
$table->addColumn($this->timeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true);
$table->addOption('collate', 'utf8mb4_bin');
$table->addOption('engine', 'InnoDB');
break;
case 'sqlite':
@@ -252,7 +251,7 @@ public function createTable()
// - trailing space removal
// - case-insensitivity
// - language processing like é == e
'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB",
'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) ENGINE = InnoDB",
'sqlite' => "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
'pgsql' => "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
'oci' => "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",

View File

@@ -62,6 +62,7 @@ public static function createHandler(object|string $connection, array $options =
throw new \InvalidArgumentException('Unsupported Redis or Memcached DSN. Try running "composer require symfony/cache".');
}
$handlerClass = str_starts_with($connection, 'memcached:') ? MemcachedSessionHandler::class : RedisSessionHandler::class;
$connection = preg_replace('/([?&])prefix=[^&]*+&?/', '\1', $connection);
$connection = AbstractAdapter::createConnection($connection, ['lazy' => true]);
return new $handlerClass($connection, array_intersect_key($options, ['prefix' => 1, 'ttl' => 1]));

View File

@@ -41,14 +41,18 @@ class MetadataBag implements SessionBagInterface
private int $updateThreshold;
private ?int $cookieLifetime;
/**
* @param string $storageKey The key used to store bag in the session
* @param int $updateThreshold The time to wait between two UPDATED updates
* @param string $storageKey The key used to store bag in the session
* @param int $updateThreshold The time to wait between two UPDATED updates
* @param int|null $cookieLifetime The configured cookie lifetime; null to read from php.ini
*/
public function __construct(string $storageKey = '_sf2_meta', int $updateThreshold = 0)
public function __construct(string $storageKey = '_sf2_meta', int $updateThreshold = 0, ?int $cookieLifetime = null)
{
$this->storageKey = $storageKey;
$this->updateThreshold = $updateThreshold;
$this->cookieLifetime = $cookieLifetime;
}
/**
@@ -143,6 +147,6 @@ private function stampCreated(?int $lifetime = null): void
{
$timeStamp = time();
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
$this->meta[self::LIFETIME] = $lifetime ?? (int) \ini_get('session.cookie_lifetime');
$this->meta[self::LIFETIME] = $lifetime ?? $this->cookieLifetime ?? (int) \ini_get('session.cookie_lifetime');
}
}