I noticed an error in smtp.transport.inc of the drupal module smtp 7.x-1.7 because of the in php 7.2 deprecated and in php 8 removed function "each()".
Unfortunatelay a customers drupal 7 project runs on a server which the provider upgraded to php 8. I think the maintainers of the smtp module didn't suppose anybody to use this combination of drupal and php version. The code with each() is
while (list(, $line) = @each($lines)) {
in line 393 and
while (list(, $line_out) = @each($lines_out)) {
in line 423. Because I already developed a solution I will answer my question by myself:
I had to rewrite the lines using each()
while (list(, $line) = @each($lines)) {
in line 393 and
while (list(, $line_out) = @each($lines_out)) {
in line 423. My solution was to replace the while... each loops with a for loop. So I changed
while (list(, $line) = @each($lines)) {
into
for ($i = 0; $i < count($lines); $i++) { $line = $lines[$i];
and the second inner loop
while (list(, $line_out) = @each($lines_out)) {
into
for ($ii = 0; $ii < count($lines_out); $ii++) { $line_out = $lines_out[$ii];
So from now on it works for me. I hope I could help those who are in the same situation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.