Seite 1 von 1

Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 13:32
von lunsen_de
Hallo, ich habe gerade in 4.10 eine Webseite implementiert. Darin das Modul article list reloaded unbd sonst nicht viele andere Module.

System 4.10
PHP Version 7.2.16

Die Seite läuft ohne Probleme, jedoch beim Aufruf einer Seite in der das Modul article_list_reloaded eingebunden ist UND ein Bild mit ausgegeben wird (ein Seite mit dem Modul ohne Ausgabe eines Bildes in der Liste erzeugt den Fehler nicht) taucht in der errorlog ein Fehler auf.

Code: Alles auswählen

[22-Mar-2019 12:03:02 UTC] PHP Warning:  Database failure: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS a WHERE a.parentid = 0' at line 1) - /2019/contenido/main.php?contenido=6odk7o5q3avbbo9pa6396nhupg&back=true SELECT a.idpica_alloc as idpica_alloc FROM  AS a WHERE a.parentid = 0
 in /var/www/vhosts/httpdocs/2019/contenido/includes/functions.general.php on line 1547
[2019-03-22 12:03:11] Warning: "Database failure: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS a WHERE a.parentid = 0' at line 1) - /2019/contenido/main.php?contenido=6odk7o5q3avbbo9pa6396nhupg&back=true SELECT a.idpica_alloc as idpica_alloc FROM  AS a WHERE a.parentid = 0
" at reportHalt() [class.db.driver.handler.php(1013)]
	reportHalt() called in file class.db.driver.handler.php(985)
	halt() called in file class.db.driver.handler.php(705)
	query() called in file include.tplcfg_edit_form.php(330) : eval()'d code(186)
	eval() called in file include.tplcfg_edit_form.php(330)
	include_once() called in file main.php(202)

[22-Mar-2019 12:03:11 UTC] PHP Warning:  Database failure: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS a WHERE a.parentid = 0' at line 1) - /2019/contenido/main.php?contenido=6odk7o5q3avbbo9pa6396nhupg&back=true SELECT a.idpica_alloc as idpica_alloc FROM  AS a WHERE a.parentid = 0
 in /var/www/vhosts/httpdocs/2019/contenido/includes/functions.general.php on line 1547
[22-Mar-2019 12:03:12 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 176
[22-Mar-2019 12:03:12 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 176
......
.....
[22-Mar-2019 12:23:01 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 224
[22-Mar-2019 12:23:01 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 224
[22-Mar-2019 12:23:01 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 224
Somit füllt sich sehr schnell das errorlogfile.
Was ist zu tun?

Grüße larslunsen

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 14:03
von xmurrix
Hallo larslunsen,

irgendwo auf der Seite wird folgende SQL-Anweisung zusammengebaut:

Code: Alles auswählen

SELECT a.idpica_alloc as idpica_alloc FROM  AS a WHERE a.parentid = 0
Da fehlt aber der Tabellenname.

Das kann passieren, wenn man z. B. das SQL in einer Funktion zusammenbaut, dabei die globale Variable $cfg verwendet wird, ohne die $cfg Variable mittels global Anweisung in den Bereich der Funktion übernommen zu haben.

Es ist auch möglich, dass die Konfiguration $cfg['tab']['pica_lang'] keinen Wert hat. Eigentlich wird dies im Content Allocation Plugin gesetzt, also in der "contenido/plugins/content_allocation/includes/config.plugin.php".
Du kannst auch in der Datei "contenido/plugins/content_allocation/includes/config.plugin.php" am Anfang folgende Zeile hinzufügen:

Code: Alles auswählen

global $cfg;
Eventuell löst das dein Problem.

Gruß
xmurrix

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 14:28
von lunsen_de
Hallo,

Code: Alles auswählen

global $cfg;
Hat Nichtsverändert.

Ich habe jetzt nur noch das eine Modul (article_list_reloaded) im Template, was unter 4.9.12 und PHP kleiner 7 ohne die Fehlermeldung funktioniert hat.

Wenn ich die Bildausgabe rausnehme ist der letze Fehler in der Log erst einmal weg (widmen wir uns sicher noch). Lediglich beim Aufrufen und Speichern der Artikelkonfiguration kommt noch:

Code: Alles auswählen

[22-Mar-2019 13:19:17 UTC] PHP Warning:  Database failure: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS a WHERE a.parentid = 0' at line 1) - /2019/contenido/main.php?area=con_tplcfg&action=tplcfg_edit&idart=90&idcat=8&frame=4&contenido=6odk7o5q3avbbo9pa6396nhupg SELECT a.idpica_alloc as idpica_alloc FROM  AS a WHERE a.parentid = 0
 in /var/www/vhosts/httpdocs/2019/contenido/includes/functions.general.php on line 1547
Im Input des Moduls finde ich:

Code: Alles auswählen

....
// check if tagging categories exist
$db6 = cRegistry::getDb();
$sql = "";
$sql = "SELECT a.idpica_alloc as idpica_alloc FROM ".$cfg["tab"]["pica_alloc"]." AS a WHERE a.parentid = 0";
$db6->query($sql);
if ($db6->numRows() > 0) {
....
Gruß larslunsen

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 14:48
von xmurrix
Der Modul-Code geht also davon aus, dass das Content Allocation Plugin installiert und aktiviert ist.

Du hast da zwei Möglichkeiten:

1. Du installierst und aktivierst das Content Allocation Plugin

2. Du baust eine Prüfung in die Moduleingabe, die nur dann die Abfrage macht, wenn die Variable $cfg["tab"]["pica_alloc"] gesetzt ist.

Code: Alles auswählen

....
if (!empty($cfg["tab"]["pica_alloc"])) {
    // check if tagging categories exist
    $db6 = cRegistry::getDb();
    $sql = "";
    $sql = "SELECT a.idpica_alloc as idpica_alloc FROM ".$cfg["tab"]["pica_alloc"]." AS a WHERE a.parentid = 0";
    $db6->query($sql);
    if ($db6->numRows() > 0) {
    ....
}
....
Der erste Weg wäre das einfachste. Besser ist es aber, wenn der Modulcode nicht ohne Prüfung auf Elemente/Inhalte von Plugins zugreift, ohne vorher zu prüfen, ob die vorhanden sind.

Gruß
xmurrix

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 15:01
von lunsen_de
Hallo, danke für die Info.

Da es wie immer schnell gehen muss habe ich Variante 1 probiert und die Fehelermeldung ist weg (hatte ich übersehen, dass das Plugin nicht installiert ist).

Jetzt habe ich die Image ausgabe in der Liste aktiviert. Jetzt taucht beim Aufruf der Seite in der errorlog noch auf:

Code: Alles auswählen

[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
Gruß larslunsen

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 15:32
von xmurrix
...danke für die Info.

Jetzt habe ich die Image ausgabe in der Liste aktiviert. Jetzt taucht beim Aufruf der Seite in der errorlog noch auf:

Code: Alles auswählen

[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant path - assumed 'path' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
[22-Mar-2019 13:57:13 UTC] PHP Warning:  Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /var/www/vhosts/httpdocs/2019/contenido/includes/frontend/include.front_content.php(762) : eval()'d code on line 156
...
Gern geschehen.

Die Fehlermeldungen kommen daher, weil irgendwo in einem Modul, vermutlich in "article_list_reloaded", auf assoziative Array-Inhalte zugegriffen wird, ohne den Schlüssel mit Hochkomma anzugeben, also

Code: Alles auswählen

$liste[path]
// oder
$liste[name]
Das sollte aber folgendermaßen lauten:

Code: Alles auswählen

$liste['path']
// oder
$liste["name"]
Gruß
xmurrix

Re: Fehlermeldung in Errorlog

Verfasst: Fr 22. Mär 2019, 15:40
von lunsen_de
Super, vielen Dank.

Im Moduloutput mit Suchen und ersetzen aus [name] wird ['name'] gemacht und für path auch und Alles funktioniert ohne Fehlermeldungen.

Danke nochmal und schönes WE.

Grüße larslunsen