StSnake hat geschrieben:...
nach dem Update von AMR auf die aktuelle Version erhalte ich beim anlegen einer neuen Kategorie folgenden Fehler:
PHP Catchable fatal error: Argument 1 passed to mr_strNewTree() must be an array, integer given in /kunden/xxx/yyy/cms/contenido/plugins/mod_rewrite/includes/functions.mod_rewrite.php on line 39...
Welche Contenido Version verwendest du?
Das kann passieren, wenn beim Anlegen einer neuen Kategorie (oder auch eines Artikels), mehrere Chain-Fuktionen verarbeitet werden. Gibt es außer dem AMR-Plugin noch andere Plugins, die eigene Chainfunktionen in folgenden Chains ausführen?
- Contenido.Action.str_newtree.AfterCall
- Contenido.Action.con_saveart.AfterCall
Die Chainbehandlung verursacht leider noch Probleme, wenn einer Chain mehrere Chain-Funktionen registriert werden, dies ist in der nächsten Contenido-Version hoffentlich und endgültig behoben.
Die Ursache kann aber auch eine Registrierte Chainfunktion sein, die in beiden Fällen ein Array als bekommt aber kein Array zurückliefert.
Sind die Chainfunktionen in Ordnung und die Ursache liegt in der Chainbehandlung, also im Aufruf von CEC_Hook::execute(), dann kannst du das um gehen, indem du auf die alte Variante der Chainbehandlung umsteigst. Beide Chains kommen im Code vor, der in der DB-Tabelle con_actions ist (sofern con_ das Präfix der Tabellen bei dir ist). Mit folgenden 2 SQL Statements werden die betroffenen Datensätze geändert:
Code: Alles auswählen
UPDATE `con_actions`
SET `code` = '$tmp_newid = strNewTree($categoryname, $categoryalias, $visible, $public, $idtplcfg);\r\nstrRemakeTreeTable();\r\n/*\r\n$cecHookRes = CEC_Hook::execute("Contenido.Action.str_newtree.AfterCall", array(\r\n ''newcategoryid'' => $tmp_newid,\r\n ''categoryname'' => $categoryname, \r\n ''categoryalias'' => $categoryalias, \r\n ''visible'' => $visible, \r\n ''public'' => $public, \r\n ''idtplcfg'' => $idtplcfg,\r\n));\r\n*/\r\n$newTreeData = array(\r\n ''newcategoryid'' => $tmp_newid,\r\n ''categoryname'' => $categoryname, \r\n ''categoryalias'' => $categoryalias, \r\n ''visible'' => $visible, \r\n ''public'' => $public, \r\n ''idtplcfg'' => $idtplcfg,\r\n);\r\n$_cecIterator = $_cecRegistry->getIterator("Contenido.Action.str_newtree.AfterCall");\r\nif ($_cecIterator->count() > 0) {\r\n while ($chainEntry = $_cecIterator->next()) {\r\n $tempNewTreeData = $chainEntry->execute($newTreeData);\r\n if (is_array($tempNewTreeData)) {\r\n $newTreeData = $tempNewTreeData;\r\n }\r\n }\r\n}\r\nunset($newTreeData);'
WHERE `idaction` = 9;
UPDATE `con_actions`
SET `code` = 'if (!isset($idtpl))\r\n{\r\n $idtpl = false;\r\n}\r\n\r\nif (!isset($artspec))\r\n{\r\n $artspec = "";\r\n}\r\n\r\nif (!isset($online))\r\n{\r\n $online = false;\r\n}\r\n\r\nif (isset($title)) \r\n{\r\n \r\n if (1 == $tmp_firstedit) \r\n {\r\n \r\n $idart = conEditFirstTime($idcat, $idcatnew, $idart, $is_start, $idtpl, $idartlang, $lang, $title, $summary, $artspec, $created, $lastmodified, $author, $online, $datestart, $dateend, $artsort);\r\n $tmp_notification = $notification->returnNotification("info", i18n("Changes saved"));\r\n \r\n if ( !isset($idartlang) ) \r\n {\r\n $sql = "SELECT idartlang FROM ".$cfg["tab"]["art_lang"]." WHERE idart = $idart AND idlang = $lang";\r\n $db->query($sql);\r\n $db->next_record();\r\n $idartlang = $db->f("idartlang");\r\n }\r\n \r\n if ( in_array($idcat, $idcatnew) ) \r\n {\r\n \r\n $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = ''".$idcat."'' AND idart = ''".$idart."''";\r\n \r\n $db->query($sql);\r\n $db->next_record();\r\n \r\n $tmp_idcatart = $db->f("idcatart");\r\n \r\n if ( $is_start == 1 ) \r\n {\r\n conMakeStart($tmp_idcatart, $is_start);\r\n }\r\n \r\n if (!isset($is_start))\r\n {\r\n if ($cfg["is_start_compatible"] == true)\r\n {\r\n \r\n $sql = "SELECT * FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = ''$idcat'' AND is_start = ''1'' ";\r\n $db->query($sql);\r\n if ( $db->next_record() ) \r\n {\r\n ; \r\n }else\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }\r\n \r\n }else\r\n {\r\n \r\n $sql = "SELECT * FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat = ''$idcat'' AND idlang = ''$lang'' AND startidartlang != ''0'' ";\r\n $db->query($sql);\r\n if ( $db->next_record() ) \r\n {\r\n $tmp_startidartlang = $db->f(''startidartlang'');\r\n if ($idartlang == $tmp_startidartlang)\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }else\r\n {\r\n ; # do nothing\r\n }\r\n \r\n }else\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n \r\n if ( is_array($idcatnew) ) \r\n {\r\n \r\n foreach ( $idcatnew as $idcat ) \r\n {\r\n \r\n $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = $idcat AND idart = $idart";\r\n \r\n $db->query($sql);\r\n $db->next_record();\r\n \r\n conSetCodeFlag( $db->f("idcatart") );\r\n \r\n }\r\n }\r\n \r\n } \r\n else \r\n {\r\n \r\n conEditArt($idcat, $idcatnew, $idart, $is_start, $idtpl, $idartlang, $lang, $title, $summary, $artspec, $created, $lastmodified, $author, $online, $datestart, $dateend, $artsort);\r\n \r\n $tmp_notification = $notification->returnNotification("info", i18n("Changes saved"));\r\n \r\n if ( !isset($idartlang) ) \r\n {\r\n $sql = "SELECT idartlang FROM ".$cfg["tab"]["art_lang"]." WHERE idart = $idart AND idlang = $lang";\r\n $db->query($sql);\r\n $db->next_record();\r\n $idartlang = $db->f("idartlang");\r\n }\r\n \r\n if ( is_array($idcatnew) ) \r\n {\r\n if ( in_array($idcat, $idcatnew) ) \r\n {\r\n \r\n $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = ''".$idcat."'' AND idart = ''".$idart."''";\r\n \r\n $db->query($sql);\r\n $db->next_record();\r\n \r\n $tmp_idcatart = $db->f("idcatart");\r\n \r\n if ( $is_start == 1 ) \r\n {\r\n conMakeStart($tmp_idcatart, $is_start);\r\n }\r\n \r\n if (!isset($is_start))\r\n {\r\n if ($cfg["is_start_compatible"] == true)\r\n {\r\n \r\n $sql = "SELECT * FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = ''$idcat'' AND is_start = ''1'' ";\r\n $db->query($sql);\r\n if ( $db->next_record() ) \r\n {\r\n ; \r\n }else\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }\r\n \r\n }else\r\n {\r\n \r\n $sql = "SELECT * FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat = ''$idcat'' AND idlang = ''$lang'' AND startidartlang != ''0'' ";\r\n $db->query($sql);\r\n if ( $db->next_record() ) \r\n {\r\n $tmp_startidartlang = $db->f(''startidartlang'');\r\n if ($idartlang == $tmp_startidartlang)\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }else\r\n {\r\n ; # do nothing\r\n }\r\n \r\n }else\r\n {\r\n conMakeStart($tmp_idcatart, 0);\r\n }\r\n \r\n }\r\n \r\n }\r\n }\r\n }\r\n \r\n if ( is_array($idcatnew) ) \r\n {\r\n \r\n foreach ( $idcatnew as $idcat ) \r\n {\r\n \r\n $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = $idcat AND idart = $idart";\r\n \r\n $db->query($sql);\r\n $db->next_record();\r\n \r\n conSetCodeFlag( $db->f("idcatart") );\r\n \r\n }\r\n }\r\n }\r\n}\r\n\r\n/*\r\n$cecHookRes = CEC_Hook::execute("Contenido.Action.con_saveart.AfterCall", array(\r\n ''idcat'' => $idcat, \r\n ''idcatnew'' => $idcatnew, \r\n ''idart'' => $idart, \r\n ''is_start'' => $is_start, \r\n ''idtpl'' => $idtpl, \r\n ''idartlang'' => $idartlang, \r\n ''lang'' => $lang, \r\n ''title'' => $title, \r\n ''urlname'' => $urlname,\r\n ''summary'' => $summary, \r\n ''artspec'' => $artspec, \r\n ''created'' => $created, \r\n ''lastmodified'' => $lastmodified, \r\n ''author'' => $author, \r\n ''online'' => $online, \r\n ''datestart'' => $datestart, \r\n ''dateend'' => $dateend, \r\n ''artsort'' => $artsort\r\n));\r\n*/\r\n$artData = CEC_Hook::execute("Contenido.Action.con_saveart.AfterCall", array(\r\n ''idcat'' => $idcat, \r\n ''idcatnew'' => $idcatnew, \r\n ''idart'' => $idart, \r\n ''is_start'' => $is_start, \r\n ''idtpl'' => $idtpl, \r\n ''idartlang'' => $idartlang, \r\n ''lang'' => $lang, \r\n ''title'' => $title, \r\n ''urlname'' => $urlname,\r\n ''summary'' => $summary, \r\n ''artspec'' => $artspec, \r\n ''created'' => $created, \r\n ''lastmodified'' => $lastmodified, \r\n ''author'' => $author, \r\n ''online'' => $online, \r\n ''datestart'' => $datestart, \r\n ''dateend'' => $dateend, \r\n ''artsort'' => $artsort\r\n));\r\n$_cecIterator = $_cecRegistry->getIterator("Contenido.Action.con_saveart.AfterCall");\r\nif ($_cecIterator->count() > 0) {\r\n while ($chainEntry = $_cecIterator->next()) {\r\n $tempArtData = $chainEntry->execute($artData);\r\n if (is_array($tempArtData)) {\r\n $artData = $tempArtData;\r\n }\r\n }\r\n}\r\nunset($artData);'
WHERE `idaction` = 55;
Mach aber vorher eine Sicherung der Tabelle con_actions. Die Änderungen habe ich nicht 100% gestestet, solte aber funktionieren...
Gruß
xmurrix