Bonjour,
sur Windows XP Pro avec PHP 5 et la dernière version CVS de SPIP ...
La boucle :
<BOUCLE_test(ARTICLES){id_secteur=43}{age_relatif_redac > -38}{age_relatif_redac < 38}{par date_redac}>
toto
</BOUCLE_test>
Le code produit dans le cache :
function html_c980b3e1bd0268df0f96e73b3ff22fbc_test(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
$result = spip_abstract_select(array("articles.lang"),
array("articles AS articles"),
array("articles.id_secteur ='43'","LEAST((UNIX_TIMESTAMP('" . normaliser_date($Pile[0][date_redac]) . '")-UNIX_TIMESTAMP(articles.date_redac))/86400,
TO_DAYS('" . normaliser_date($Pile[0][date_redac]) . '")-TO_DAYS(articles.date_redac),
DAYOFMONTH('" . normaliser_date($Pile[0][date_redac]) . '")-DAYOFMONTH(articles.date_redac)+30.4368*(MONTH('" . normaliser_date($Pile[0][date_redac]) . '")-MONTH(articles.date_redac))+365.2422*(YEAR('" . normaliser_date($Pile[0][date_redac]) . '")-YEAR(articles.date_redac))) >'-38'","LEAST((UNIX_TIMESTAMP('" . normaliser_date($Pile[0][date_redac]) . '")-UNIX_TIMESTAMP(articles.date_redac))/86400,
TO_DAYS('" . normaliser_date($Pile[0][date_redac]) . '")-TO_DAYS(articles.date_redac),
DAYOFMONTH('" . normaliser_date($Pile[0][date_redac]) . '")-DAYOFMONTH(articles.date_redac)+30.4368*(MONTH('" . normaliser_date($Pile[0][date_redac]) . '")-MONTH(articles.date_redac))+365.2422*(YEAR('" . normaliser_date($Pile[0][date_redac]) . '")-YEAR(articles.date_redac))) <'38'","articles.statut='publie'"),
'',
date_redac,
"",
'',
1,
'articles',
'_test');
$t0 = "";
$SP++;
$Numrows['_test'] = @spip_num_rows($result);
for($x=$Numrows["_test"];$x>0;$x--) $t0.= '
toto
';
@spip_free_result($result);
return $t0;
}
Le bug :
Parse error: parse error, unexpected '"', expecting ')' in d:\sites web\gastero prod\@www.gasteroprod.com\html\inc-cache.php3(104) : eval()'d code on line 45
Fatal error: Call to undefined function html_c980b3e1bd0268df0f96e73b3ff22fbc() in d:\sites web\gastero prod\@www.gasteroprod.com\html\inc-calcul.php3 on line 57
Le problème est au niveau de l'utilisation mixée de " et ' dans les requêtes, pour délimiter les valeurs.
On a par exemple au début :
'" . normaliser_date($Pile[0][date_redac]) . '"
On ferme avec un ", puis on rouvre avec un '.
OTH.
-Nicolas