Make WordPress Core

Opened 3 months ago

Closed 3 months ago

#64332 closed defect (bug) (fixed)

Incomplete accounting for MariaDB version being prefixed with '5.5.5-' on older PHP versions

Reported by: maximumsoftware's profile maximumsoftware Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: Database Keywords: good-first-bug has-patch
Focuses: Cc:

Description

In the file wp-includes/class-wpdb.php, function has_cap, near Account for MariaDB version being prefixed with '5.5.5-' on older PHP versions, there is a possible issue with PHP_VERSION_ID < 80016 // PHP 8.0.15 or older..

The problem is that if you look at https://www.php.net/ChangeLog-8.php, you can see that GH-7972 is fixed twice, once in 8.0.16 and second time in 8.1.3, which means the prefix is still there in 8.1.0 - 8.1.2. So, PHP_VERSION_ID < 80016 should actually be (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)).

Change History (5)

#1 @SergeyBiryukov
3 months ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 7.0

This ticket was mentioned in PR #10588 on WordPress/wordpress-develop by @hbhalodia.


3 months ago
#2

  • Keywords has-patch added; needs-patch removed
  • Update the MariaDB prefix condition to include the PHP version that does not include the stripped version.

Trac ticket: https://core.trac.wordpress.org/ticket/64332

#3 @hbhalodia
3 months ago

Hi @SergeyBiryukov @maximumsoftware, I have addded the PR with the required updates. Can you please help review the same.

Thank You,

#4 @SergeyBiryukov
3 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @SergeyBiryukov
3 months ago

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

In 61349:

Database: Further correct MariaDB version check in wpdb::has_cap().

On older PHP versions, MariaDB version is reported with the 5.5.5- prefix, e.g. 5.5.5-10.6.24-MariaDB.

This includes PHP 8.0.15 or earlier, as well as PHP 8.1.0—8.1.2, which was not accounted for previously.

This commit updates the condition for removing the 5.5.5- prefix to include PHP 8.1.0—8.1.2.

Follow-up to [54384].

Props maximumsoftware, hbhalodia, SergeyBiryukov.
Fixes #64332.

Note: See TracTickets for help on using tickets.