Warning PHP : variable $published non initialisée dans post_form.php #6

Closed
opened 2026-05-08 11:30:21 +00:00 by cedricAbonnel · 0 comments
Owner

Problème

Le template templates/post_form.php utilisait $published directement à la ligne 44 sans valeur par défaut. Dans le contexte create (nouveau post), cette variable n'est pas transmise par route.php, ce qui génère un warning PHP :

PHP Warning: Undefined variable $published in templates/post_form.php on line 44

Correction

Ajout du fallback ?? false (commit 7bf05b0), cohérent avec le pattern déjà utilisé pour $published_at :

<?= ($published ?? false) ? 'checked' : '' ?>

Statut

Corrigé et déployé (commit 7bf05b0).

## Problème Le template `templates/post_form.php` utilisait `$published` directement à la ligne 44 sans valeur par défaut. Dans le contexte `create` (nouveau post), cette variable n'est pas transmise par `route.php`, ce qui génère un warning PHP : ``` PHP Warning: Undefined variable $published in templates/post_form.php on line 44 ``` ## Correction Ajout du fallback `?? false` (commit 7bf05b0), cohérent avec le pattern déjà utilisé pour `$published_at` : ```php <?= ($published ?? false) ? 'checked' : '' ?> ``` ## Statut Corrigé et déployé (commit `7bf05b0`).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cedricAbonnel/varlog#6