Modify

Opened 5 years ago

Closed 5 years ago

#1859 closed Bug/Fehler (fixed)

Notice wegen MAX_DISPLAY_PAGE_LINKS in split_page_results.php

Reported by: noRiddle 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

Wenn Konfiguration => Maximum Werte => "Seiten blättern" (= MAX_DISPLAY_PAGE_LINKS) auf 0 steht wirft Zeile 106 in /includes/classes/split_page_results.php im Produkt-Listing eine Notice à la "Modulo 0 nicht möglich":

if ($this->current_page_number % $max_page_links) $cur_window_num++;

Die Zeile darüber dürfte ebenfalls eine Notice oder ein Warning werfen wegen "dividing by 0":

$cur_window_num = (int)($this->current_page_number / $max_page_links);

Da man in configuration-Feldern keine Vorgabe machen kann sollte man das abfangen.
Als einfachste Variante würde mir folgendes erscheinen:

Direkt am Anfang der Methode display_links() das

$corr_max_page_links = $max_page_links > 0 ? $max_page_links : 1;

und im Code der Methode alle $max_page_links mit $corr_max_page_links ersetzen.

Gruß,
noRiddle

Attachments (0)

Change History (5)

comment:1 by Torsten Riemer, 5 years ago

Noch einfacher ist es der Minimum Wert einfach auf 1 zu setzen in der "/admin/includes/configuration_limits.php":

$value_limits['MAX_DISPLAY_PAGE_LINKS'] = array('min' => 1);

comment:2 by noRiddle, 5 years ago

Ach die gibt's ja auch noch. Da hast du natürlich Recht.

Ich fänd's übrigens cool wenn die /admin/includes/configuration_limits.php ein auto_include hätte.

Gruß,
noRiddle

comment:3 by noRiddle, 5 years ago

*NACHTRAG*
...und in der /admin/configuration.php geschieht bei der Prüfung auf vorhandene Limits auch eine Prüfung auf numerischen POST-Wert mittels preg_match().
Das mittels Regex zu machen ist etwas aufwändig wo doch ein ctype_digit() ausreichen würde.

Gruß,
noRiddle

comment:4 by Torsten Riemer, 5 years ago

Werden wir dann entsprechend über die "/admin/includes/configuration_limits.php" lösen.

Das mit dem ctype_digit() und dem auto_include schauen wir uns noch an.

comment:5 by Gerhard Waldemair, 5 years ago

Resolution: fixed
Status: newclosed

In 12848:

fix #1859 - fix notice for MAX_DISPLAY_PAGE_LINKS in split_page_results.php

Modify Ticket

Action
as closed The owner will remain somebody.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.