-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Labels
bugSomething isn't workingSomething isn't workingchangeloggedupstreamAn issue related to a problem on a dependency of this pluginAn issue related to a problem on a dependency of this plugin
Description
When adding a Code block, I'm seeing a warning in the error log:
PHP Warning: DOMDocument::loadHTML(): Empty string supplied as input in /app/public/content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight.php/HighlightUtilities/functions.php on line 179
It should avoid calling splitCodeIntoArray() if $content is empty:
--- a/syntax-highlighting-code-block.php
+++ b/syntax-highlighting-code-block.php
@@ -510,7 +510,7 @@ function render_block( $attributes, $content ) {
require_highlight_php_functions();
$highlighted_lines = parse_highlighted_lines( $attributes['highlightedLines'] );
- $lines = \HighlightUtilities\splitCodeIntoArray( $content );
+ $lines = empty( $content ) ? [] : \HighlightUtilities\splitCodeIntoArray( $content );
$content = '';
// We need to wrap the line of code twice in order to let out `white-space: pre` CSS setting to be respectedMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingchangeloggedupstreamAn issue related to a problem on a dependency of this pluginAn issue related to a problem on a dependency of this plugin