Problems changing from PHP7 to PHP8

Hi,
I also have problems with switching from PHP7 to PHP8 these warnings appear when I insert a new user (however, the insertion operation is successful):
(I have simplified the file references)

  • “WARNING: Undefined Array Key” ID _…" in /……/DbTable.php on line 245"
    these are the rows of the “save ()” method (the 245 is the first after the try instruction):
    try {
    If ($record [$this-> primaryKey] == '') {
    $record [$this-> primaryKey] = null;
    }

  • “Warning: Cannot modify header information - headers already sent by (output started at /……/DbTable.php:245) in /……/Register.php on line 88”
    this is the line 88 of the “RegisterUser()” method:
    header (‘location: /participanti/success);

  • “Warning: trying to access array offset on value of type null in /…/EntryPoint.php on line 50” and the same “error” on line 55
    this is the line 50 of the “run ()” method:
    $title = $page[‘title'];
    and 55:
    $output = $this-> loadTemplate($page[‘template']);

  • “Warning: include(/…/ templates): Failed to open stream: No error information in /……/EntryPoint.php on line 28”

  • “WARNING: includes(): Failed opening ‘/…/templates/’ for inclusion (include_path=‘.: /usr/local/lib/php’) in /……/EntryPoint.php on line 28”
    this is the line 28 of the “loadTemplate()" method:
    include __DIR__ . '/../../templates/' . $templateFileName;

this is not my code, I followed the example given in the book “PHP & MySQL” sixth edition and I made some changes for my site … but not in this part where the warnings appear.
Gabriele (Italy)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.