Make WordPress Core


Ignore:
Timestamp:
07/06/2022 05:31:47 AM (4 years ago)
Author:
peterwilsoncc
Message:

Database: Ensure MySQL port numbers are numeric in wpdb.

Ensure the database port number is recorded as an integer or null (the default port) when parsing the database host.

This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.

Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes #54877.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r53584 r53670  
    20772077                        }
    20782078                }
     2079
     2080                // MySQLi port cannot be a string; must be null or an integer.
     2081                $port = $port ? absint( $port ) : null;
    20792082
    20802083                return array( $host, $port, $socket, $is_ipv6 );
Note: See TracChangeset for help on using the changeset viewer.