Skip to content

Regression of non-ANSI strings handing in 6.2.0 #515

@LarnuUK

Description

@LarnuUK

The merge from 6.2.0 has made a change to the file class-wpdb.php (which replaced the now deprecated file wp-includes/wp-db.php) which removed several lines, including the following on line 1470:

$query = preg_replace( "/(?<!%)(%($allowed_format)?f)/", '%\\2F', $query ); // Force floats to be locale-unaware.
$query = preg_replace( '/(?<!%)%s/', " N'%s'", $query ); // Quote the strings, avoiding escaped strings like %%s.

The N' at the start ensured that strings were passed as an nvarchar, rather than a varchar, which is vital as the columns in the database from Nami are nvarchar values as well; using varchar literals would result in data loss as characters outside of the code page of the database would appear as ?.

This is still the case in the latest version, and so characters outside the code page (likely ANSI) are lost.

As the line that was there before has been completely removed, I'm unsure if it should have been (and was in error), or if the new line is designed to try to address what the prior lines did:

$query = preg_replace( "/%(?:%|$|(?!($allowed_format)?[sdfFi]))/", '%%\\1', $query );

I did a quick test and adding the old preg_replace line breaks the site, this occurs when placing it both before and after the new line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions