Critères evenement_passe & evenement_a_venir incompatibles avec MySQL 5.6
Update
Le truc important est que la valeur présente dans #ENV{archives}
est du type 2022-05, si j'utilise {!evenement_passe #ENV{archives}|agenda_moisdecal{1}}{!evenement_a_venir #ENV{archives}|agenda_moisdecal{2}}
qui force son format en 2022-05-10, tout rentre dans l'odre... Je ne sais pas si mon cas d'usage est "licite".
Description
Sous SPIP 4.0.6 avec MySQL 5.6 j'utilise la combinaison suivante recommandée en remplace du critère agendafull :
{!evenement_passe #ENV{archives}}{!evenement_a_venir #ENV{archives}|agenda_moisdecal{1}}
La requête générée provoque un Warning: #1292 Incorrect datetime value: '2022-05' for column 'date_fin' at row 1
et fait qu'elle ne renvoie aucun événement :
SELECT evenements.date_debut, evenements.id_evenement, evenements.timezone_affiche
FROM spip_evenements AS `evenements`
WHERE (evenements.statut = 'publie')
AND (((horaire = 'oui') AND (evenements.date_fin >= '2022-05')) OR ((horaire != 'oui') AND (evenements.date_fin >= '2022-05-01 00:00:00')))
AND (((horaire = 'oui') AND (evenements.date_debut <= '2022-04-30 01:01:01')) OR ((horaire != 'oui') AND (evenements.date_debut <= '2022-04-30 23:59:59')))
AND (evenements.id_article = 1498)
GROUP BY evenements.id_evenement
ORDER BY evenements.date_debut;
Si je remplace les critères par l'ancienne code que j'utilisais avant cf {agendafull date_debut,date_fin, mois, #ENV{archives}|affdate{'Y'}, #ENV{archives}|affdate{'m'}}
la requête générée fonctionne bien :
SELECT evenements.date_debut, evenements.id_evenement, evenements.timezone_affiche
FROM spip_evenements AS `evenements`
INNER JOIN spip_articles AS L1 ON ( L1.id_article = evenements.id_article )
WHERE (evenements.statut = 'publie')
AND ((DATE_FORMAT(date_debut, '%Y%m') <= '202204') AND (DATE_FORMAT(date_fin, '%Y%m') >= '202204'))
AND (evenements.id_article = 1498)
GROUP BY evenements.id_evenement
ORDER BY evenements.date_debut;
À noter, que la combinaison evenement_passe & evenement_a_venir fonctionne bien sous mariadb version: 5.5.5-10.3.34-MariaDB-0ubuntu0.20.04.1.
J'ai comparé la conf mysql au niveau de sql_mode, avec MySQL 5.6 j'ai uniquement NO_ENGINE_SUBSTITUTION
et en local sous mariadb j'ai STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
.