WordPress.org

Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#43109 closed defect (bug) (fixed)

RegEx in parse_db_host() can cause notices and headers sent too early

Reported by: gallerycy Owned by: dd32
Milestone: 4.9.3 Priority: normal
Severity: normal Version: 4.9
Component: Database Keywords:
Focuses: Cc:
PR Number:

Description

WP have installed this update and I am now unable to access the dashboard - please can you help? The site is gallerycy.com

Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /web1/user53852/website/wp-includes/wp-db.php on line 1657

Warning: Cannot modify header information - headers already sent by (output started at /web1/user53852/website/wp-includes/wp-db.php:1657) in /web1/user53852/website/wp-includes/pluggable.php on line 1216

Change History (9)

#1 @Clorith
22 months ago

  • Component changed from General to Database
  • Summary changed from WP 4.9.2 to RegEx in parse_db_host() can cause notices and headers sent too early
  • Version changed from 4.9.2 to 4.9

Hi there, and welcome to WordPress Trac!

Some quick digging shows that this has happened to a few people after 4.9 introduced a new function, would you be able to share some more information with us about your setup, most notably what version of PHP you are using and if you know it, is it a Windows or linux based host?

For reference, this relates to the parse_db_host() function and the RegEx used there to split up hosts and ports.

There's been some digging on the forums, and is likely caused by outdated PCRE libraries, we can work around this by using a slightly different syntax it seems (See Otto's comment)

#2 @Presskopp
22 months ago

curl shows it's PHP5.4.33 / Apache 2.2.3 (CentOS)

#3 @dd32
22 months ago

  • Milestone changed from Awaiting Review to 4.9.4

I'm going to milestone this to a 4.9.x, It sounds like something we can easily work around, so we might as well do it.

This ticket was mentioned in Slack in #core by dd32. View the logs.


22 months ago

#5 @dingdang
22 months ago

PHP=5.3.3 from CentOS 5.11 which means it is not exactly 5.3.3 but something like that (with security patches)
Using 5.4.45 on the same set up the warning disappears.

Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in .../wp-includes/wp-db.php on line 1657

#6 @dd32
22 months ago

  • Milestone changed from 4.9.4 to 4.9.3

#7 @dd32
22 months ago

  • Owner set to dd32
  • Status changed from new to accepted

From https://www.pcre.org/original/changelog.txt
PCRE Version 4.0 (17-Feb-2003) added (?P<name>..) syntax.
PCRE Version 7.0 (19-Dec-2006) added (?<name>..) syntax.

Lets just update it to the first syntax, an extra character isn't going to cause harm :)

#8 @dd32
22 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 42549:

WPDB: Use a PCRE syntax which supports PCRE compiled between 2003 and 2006.

This fixes a PHP Warning in wpdb::parse_db_host() when WordPress is used with (sometimes a modern) PHP that's compiled against an ancient PCRE version.

Fixes #43109 for trunk.

#9 @dd32
22 months ago

In 42550:

WPDB: Use a PCRE syntax which supports PCRE compiled between 2003 and 2006.

This fixes a PHP Warning in wpdb::parse_db_host() when WordPress is used with (sometimes a modern) PHP that's compiled against an ancient PCRE version.

Merges [42549] to the 4.9 branch.
Fixes #43109 for 4.9.

Note: See TracTickets for help on using tickets.