#2250 closed Bug/Fehler (fixed)
Warning Trying to access array offset on value of type bool
| Reported by: | anonymous | Owned by: | somebody |
|---|---|---|---|
| Priority: | normal | Milestone: | modified-shop-2.0.7.1 |
| Component: | Shop | Version: | 2.0.7.0 |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: |
Description
In /inc/xtc_get_vpe_name.inc.php kommt dieses Warning unter PHP8.1.3 mit modified eCommerce Shopsoftware v2.0.7.0 rev 14473 dated: 2022-05-17
Zeile 32 habe ich ergänzt (setzt allerdings PHP8 voraus)
$vpe_name_array[$languages_id][$products_vpe_id] = $vpe_nameproducts_vpe_name ?? ;
ansonsten natürlich abwärtskompatibel
$vpe_name_array[$languages_id][$products_vpe_id] = isset($vpe_nameproducts_vpe_name) ? $vpe_nameproducts_vpe_name : ;
Attachments (0)
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Das kann nur passieren, wenn eine products_vpe_id abgefragt wird, die nicht existiert. Wenn das vorkommt, dann sind definitiv Inkonsistenten in der Datenbank vorhanden.
zB ist einem Artikel eine ID zugeordnet, diese ist aber nicht in der Tabelle products_vpe vorhanden.
Ein besserer Lösungsansatz ist auf die Variable nur zuzugreifen, wenn auch ein Ergebnis aus der DB kommt.

Nochmal in lesbarer Formatierung, man lernt ja schließlich dazu
$vpe_name_array[$languages_id][$products_vpe_id] = $vpe_name['products_vpe_name'] ?? '';ansonsten natürlich abwärtskompatibel
$vpe_name_array[$languages_id][$products_vpe_id] = isset($vpe_name['products_vpe_name']) ? $vpe_name['products_vpe_name'] : '';