Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#63131 new defect (bug)

Possible bug (not strict) use of preg_split in formatting.php

Reported by: pjsgsy's profile pjsgsy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

Hello,

With PHP 8.4 and the latest 6.7.2, I get and error on my home page (using Salient theme if that matters).

The error is on line 3479 in formatting.php

$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); Capture the tags as well as in between.

This breaks the home page. it seems to be a lexical warning more than anything else so it can be fixed by suppressing the error

$textarr = @preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); Capture the tags as well as in between.

This resolves the issue.

Change History (2)

@audrasjb commented on PR #8553:


4 weeks ago
#2

Thanks for the PR, but instead of hiding the error using @preg_split, we should rather explore why there is a warning at the first place and fix it if needed :)

Note: See TracTickets for help on using tickets.