Skip to content

Commit 19d9599

Browse files
committed
Fix null document_title preg_replace
1 parent cfa1dd3 commit 19d9599

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

html-api-debugger/html-api-integration.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ function get_tree( string $html, array $options ): array {
419419
* https://html.spec.whatwg.org/multipage/dom.html#document.title
420420
* https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
421421
*/
422-
$document_title = trim( preg_replace( "/[\t\n\f\r ]+/", ' ', $document_title ), "\t\n\f\r " );
422+
if ( null !== $document_title ) {
423+
$document_title = trim( preg_replace( "/[\t\n\f\r ]+/", ' ', $document_title ), "\t\n\f\r " );
424+
}
423425

424426
return array(
425427
'tree' => $tree,

0 commit comments

Comments
 (0)