Skip to content

fix(handler): initialiser nextRotation dans setFilenameFormat pour monolog 3.13 - #47

Merged
thislg merged 3 commits into
masterfrom
fix-monolog-3-13-next-rotation
Nov 18, 2026
Merged

thislg merged 3 commits into
masterfrom
fix-monolog-3-13-next-rotation

Conversation

@thislg

@thislg thislg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #46

Correctif

RotatingFileHandlerTrait::setFilenameFormat() initialise maintenant $nextRotation :

  • monolog ≥ 3.12 : via getNextRotation(), qui gère aussi les rotations à l'heure, au mois et à l'année ;
  • monolog 2 : new \DateTimeImmutable('tomorrow'), comme le faisait son constructeur.

La contrainte monolog/monolog: ^2.0|^3.0 reste inchangée.

CI

phpspreadsheet 1.30.7+ exige php <8.5 : le job PHP 8.5 ne résolvait plus les dépendances. La contrainte de dev passe à ^1.19|^2.0|^3.0|^4.0|^5.0. ExcelLoader n'utilise que IOFactory, le writer Csv et StringHelper, inchangés jusqu'à la 5.x.

Tests

  • Tests/Handler/RotatingFileHandlerTest écrit une ligne via le handler et vérifie qu'elle arrive dans le fichier daté. Avec monolog 3.13.0, il échoue sans le correctif (même erreur que dans l'issue) et passe avec.
  • Tests/Load/ExcelLoaderTest couvre ExcelLoader, qui n'avait aucun test : supports(), puis load() sur un vrai fichier .xls (délimiteur ; dans une valeur, accents, décimal), avec les fonctions pg_* simulées comme dans CsvLoaderTest. Il vérifie les lignes envoyées à PostgreSQL et la suppression du CSV temporaire.

Vérifié en local, sans lock, sur PHP 8.5 (monolog 3.13, phpspreadsheet 5.11) et PHP 7.4 (phpspreadsheet 1.x) : validate, PHPStan et tests OK.

…g 3.13

Monolog 3.13 sets nextRotation in setFilenameFormat() instead of the
constructor. The trait overrides that method, so the property stayed
uninitialized and the first log write threw an Error.
phpspreadsheet 1.30.7+ requires php <8.5, so the PHP 8.5 job could no
longer resolve dependencies. ExcelLoader only uses IOFactory, the Csv
writer and StringHelper, unchanged up to 5.x.
@thislg
thislg merged commit 137399d into master Nov 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Erreur « nextRotation must not be accessed before initialization » avec monolog 3.13

1 participant