1
0

PHP 8 compat fixes for the core when trackack plugin is installed

This commit is contained in:
onli
2021-06-06 18:53:48 +02:00
parent e0d87c88cf
commit ef79ef260b
5 changed files with 11 additions and 8 deletions

View File

@@ -1358,8 +1358,10 @@ function serendipity_updertEntry($entry) {
$categories = $entry['categories']; $categories = $entry['categories'];
unset($entry['categories']); unset($entry['categories']);
$had_categories = $entry['had_categories']; if (isset($entry['had_categories'])) {
unset($entry['had_categories']); $had_categories = $entry['had_categories'];
unset($entry['had_categories']);
}
$newEntry = 0; $newEntry = 0;
$exflag = 0; $exflag = 0;

View File

@@ -760,7 +760,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
continue; continue;
} }
if (preg_match_all('@<img[^>]+?alt=["\']?([^\'">]+?)[\'"][^>]+?>@i', $names[$i], $img_alt)) { if (isset($names[$i]) && preg_match_all('@<img[^>]+?alt=["\']?([^\'">]+?)[\'"][^>]+?>@i', $names[$i], $img_alt)) {
if (is_array($img_alt) && is_array($img_alt[0])) { if (is_array($img_alt) && is_array($img_alt[0])) {
foreach($img_alt[0] as $alt_idx => $alt_img) { foreach($img_alt[0] as $alt_idx => $alt_img) {
// Replace all <img>s within a link with their respective ALT tag, so that references // Replace all <img>s within a link with their respective ALT tag, so that references
@@ -780,7 +780,9 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($row); if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($row);
} }
$names[$i] = strip_tags($names[$i]); if (isset($names[$i])) {
$names[$i] = strip_tags($names[$i]);
}
if (empty($names[$i])) { if (empty($names[$i])) {
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Found reference $locations[$i] w/o name. Adding location as name"); if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Found reference $locations[$i] w/o name. Adding location as name");
$names[$i] = $locations[$i]; $names[$i] = $locations[$i];

View File

@@ -31,7 +31,6 @@ if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) {
} }
// Try and include preferred language from the configurated setting // Try and include preferred language from the configurated setting
if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) { if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) {
// Only here can we truly say the language is loaded // Only here can we truly say the language is loaded
define('serendipity_LANG_LOADED', true); define('serendipity_LANG_LOADED', true);

View File

@@ -1816,13 +1816,13 @@ class serendipity_event extends serendipity_plugin
} else { } else {
$key = &$eventData[0][$fieldname]; $key = &$eventData[0][$fieldname];
} }
} elseif (is_array($eventData) && is_array($eventData['properties'])) { } elseif (is_array($eventData) && is_array($eventData['properties'] ?? null)) {
if (!empty($eventData['properties']['ep_cache_' . $fieldname])) { if (!empty($eventData['properties']['ep_cache_' . $fieldname])) {
$key = &$eventData['properties']['ep_cache_' . $fieldname]; $key = &$eventData['properties']['ep_cache_' . $fieldname];
} else { } else {
$key = &$eventData[$fieldname]; $key = &$eventData[$fieldname];
} }
} elseif (is_array($eventData[0]) && isset($eventData[0][$fieldname])) { } elseif (isset($eventData[0]) && isset($eventData[0][$fieldname])) {
$key = &$eventData[0][$fieldname]; $key = &$eventData[0][$fieldname];
} elseif (isset($eventData[$fieldname])) { } elseif (isset($eventData[$fieldname])) {
$key = &$eventData[$fieldname]; $key = &$eventData[$fieldname];

View File

@@ -772,7 +772,7 @@ class serendipity_event_entryproperties extends serendipity_event
break; break;
case 'backend_entry_presave': case 'backend_entry_presave':
if (is_array($serendipity['POST']['properties'])) { if (is_array($serendipity['POST']['properties'] ?? null)) {
$this->applyProperties($serendipity['POST']['properties']); $this->applyProperties($serendipity['POST']['properties']);
} }
break; break;