From 00dc377b2eb3de65dca10e3d14870561f40fabf0 Mon Sep 17 00:00:00 2001 From: Nicolas FORM Date: Mon, 6 Feb 2023 12:20:47 +0100 Subject: [PATCH 1/4] Fix implode: delimiter should be the first argument since php 8 --- util/crayon_util.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/crayon_util.class.php b/util/crayon_util.class.php index 9a40608c..e81172f2 100644 --- a/util/crayon_util.class.php +++ b/util/crayon_util.class.php @@ -70,7 +70,7 @@ public static function lines($path, $opts = NULL) { if ($whitespace) { $delimiter = CRAYON_NL; } - $lines = implode($lines, $delimiter); + $lines = implode($delimiter, $lines); } return $lines; From c4d5f4ed9855a19667099179be245255b806067c Mon Sep 17 00:00:00 2001 From: Nicolas FORM Date: Mon, 6 Feb 2023 12:21:17 +0100 Subject: [PATCH 2/4] Fix warning about numeric values --- crayon_formatter.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crayon_formatter.class.php b/crayon_formatter.class.php index 9adf4c46..eef77fa8 100644 --- a/crayon_formatter.class.php +++ b/crayon_formatter.class.php @@ -115,8 +115,8 @@ public static function print_code($hl, $code, $line_numbers = TRUE, $print = TRU $_line_height = $hl->setting_val(CrayonSettings::LINE_HEIGHT); // Don't allow line height to be less than font size $line_height = ($_line_height > $_font_size ? $_line_height : $_font_size) . 'px !important;'; - $toolbar_height = $font_size * 1.5 . 'px !important;'; - $info_height = $font_size * 1.4 . 'px !important;'; + $toolbar_height = ($_font_size * 1.5) . 'px !important;'; + $info_height = ($_font_size * 1.4) . 'px !important;'; $font_style .= "font-size: $font_size line-height: $line_height"; $toolbar_style .= "font-size: $font_size"; From b82f22ca9054287669438ce917c7ff0a4e966e1a Mon Sep 17 00:00:00 2001 From: Nicolas FORM Date: Mon, 6 Feb 2023 12:21:38 +0100 Subject: [PATCH 3/4] Fix invalid regexp --- crayon_langs.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crayon_langs.class.php b/crayon_langs.class.php index 651f55c8..dfb0b544 100644 --- a/crayon_langs.class.php +++ b/crayon_langs.class.php @@ -337,7 +337,7 @@ function __construct($id, $name = NULL) { // Override function clean_id($id) { $id = CrayonUtil::space_to_hyphen( strtolower(trim($id)) ); - return preg_replace('/[^\w-+#]/msi', '', $id); + return preg_replace('/[^\w+#-]/msi', '', $id); } function ext($ext = NULL) { From f9d9abdb66eadbad0e1d703f6234ff1441e3a86a Mon Sep 17 00:00:00 2001 From: Nicolas FORM Date: Mon, 6 Feb 2023 12:22:02 +0100 Subject: [PATCH 4/4] Fix @get_class: does not support NULL value since PHP 8 --- crayon_langs.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crayon_langs.class.php b/crayon_langs.class.php index dfb0b544..f522cca6 100644 --- a/crayon_langs.class.php +++ b/crayon_langs.class.php @@ -411,7 +411,7 @@ function element($name, $element = NULL) { $name = trim(strtoupper($name)); if (array_key_exists($name, $this->elements) && $element === NULL) { return $this->elements[$name]; - } else if (@get_class($element) == CRAYON_ELEMENT_CLASS) { + } else if ($element !== NULL && @get_class($element) == CRAYON_ELEMENT_CLASS) { $this->elements[$name] = $element; } }