Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 views
in Technique[技术] by (71.8m points)

php - How can fix this in php5.6? its possible without update to php7.4?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...