i have this small script in php to send mails, after two months i found a bad behavior in the log files but i can't found the problem.
I tested in my computer and in another instance, with php 7.4, and have the expected output but when run in server (with php 5.6) i get this unexpected output in log file.
The code is:
if(isset($mailingList)){
foreach ($mailingList as $user) {
$title = "
" . $user->tit;
$title.= "
Fecha del préstamo: " . $user->aff_pret_date . " Devolución el: " . $user->aff_pret_retour;
$title.= "
" . $user->location_libelle . " : " . $user->section_libelle . " (" . $user->expl_cb . ") " . "
";
wordwrap($body, 70, "
", TRUE);
if ($idUser == null){
$idUser = $user->id_empr;
}
if ($idUser <> $user->id_empr) {
if (next($mailingList) == false){
$receiver = $user->empr_mail;
$subject = "CITEIN : préstamos atrasados: " . $user->empr_prenom . " " . $user->empr_nom . " (" . $user->id_empr . ") ";
$body = $header . $title . $signLatu;
$idUser = $user->id_empr;
Send($receiver, $subject, $body, $idUser);
} else {
$body = $header . $titleList . $signLatu;
Send($receiver, $subject, $body, $idUser);
$titleList = $title;
}
} else {
$titleList.= $title;
if (next($mailingList) == false){
$body = $header . $titleList . $signLatu;
Send($receiver, $subject, $body, $idUser);
}
}
$idUser = $user->id_empr;
$receiver = $user->empr_mail;
$subject = "CITEIN : préstamos atrasados: " . $user->empr_prenom . " " . $user->empr_nom . " (" . $user->id_empr . ") ";
}
}
Unexpected output
****************************
Mensaje para UserID: 9636
Calidad en los servicios educativos
Fecha del préstamo: 23/11/2020 Devolución el: 21/12/2020
Libros (30032)
****************************
****************************
Mensaje para UserID: 9636
Calidad en los servicios educativos
Fecha del préstamo: 23/11/2020 Devolución el: 21/12/2020
Libros (30032)
Educación y calidad total
Fecha del préstamo: 23/11/2020 Devolución el: 21/12/2020
Libros (13631)
****************************
Expected Output
****************************
Mensaje para UserID: 6116
Compendium of methods for the microbiological examination of foods
Fecha del préstamo: 21/01/2020 Devolución el: 21/01/2021
Libros (19961)
****************************
****************************
Mensaje para UserID: 9636
Calidad en los servicios educativos
Fecha del préstamo: 23/11/2020 Devolución el: 21/12/2020
Libros (30032)
Educación y calidad total
Fecha del préstamo: 23/11/2020 Devolución el: 21/12/2020
Libros (13631)
****************************
If you see, in php5.6 repeat the book before the last, and the previous disappears. How can i do for fix this? i'm trying to not update to php7.4
question from:
https://stackoverflow.com/questions/65946658/how-can-fix-this-in-php5-6-its-possible-without-update-to-php7-4 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…