Opened 5 years ago

Last modified 5 years ago

#1900 closed Bug/Fehler

Undefined variable: author in File: product_reviews_write.php on Line: 158 — at Version 1

Reported by: Timo Paul Owned by: somebody
Priority: normal Milestone: modified-shop-2.0.6.0
Component: Shop Version: 2.0.5.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Torsten Riemer)

Kompletter Eintrag in der mod_notice_*.log:

[2020-09-28 05:10:04]	[notice]	[modified]	[pid:96812]	Undefined variable: author in File: /var/www/shop-root/product_reviews_write.php on Line: 158	{}	{}

Die Variable $author ist nicht vordefiniert und bleibt somit undefiniert wenn Gäste ein Produkt bewerten möchten.

Betroffene Zeilen: 133 - 144

  if (!isset($author)) {
    if(isset($_SESSION['customer_id'])) {
      $customer_info_query = xtc_db_query("SELECT customers_firstname,
                                                  customers_lastname
                                             FROM ".TABLE_CUSTOMERS."
                                            WHERE customers_id = '".(int) $_SESSION['customer_id']."'");
      if (xtc_db_num_rows($customer_info_query) > 0) {
        $customer_info = xtc_db_fetch_array($customer_info_query);
        $author = $customer_info['customers_firstname'].' '.$customer_info['customers_lastname'][0].'.';
      }
    }
  }

Lösung in Zeile 134 die Variable vordefinieren:

  if (!isset($author)) {
    $author = '';
    if(isset($_SESSION['customer_id'])) {
      $customer_info_query = xtc_db_query("SELECT customers_firstname,
                                                  customers_lastname
                                             FROM ".TABLE_CUSTOMERS."
                                            WHERE customers_id = '".(int) $_SESSION['customer_id']."'");
      if (xtc_db_num_rows($customer_info_query) > 0) {
        $customer_info = xtc_db_fetch_array($customer_info_query);
        $author = $customer_info['customers_firstname'].' '.$customer_info['customers_lastname'][0].'.';
      }
    }
  }

Change History (1)

comment:1 by Torsten Riemer, 5 years ago

Description: modified (diff)
Milestone: modified-shop-2.0.5.2
Version: 2.0.5.1
Note: See TracTickets for help on using tickets.