Skip to content

Backslashes being escaped in where conditions. #866

Description

@daylightstudio

I have a scenario where I'm saving a value that contains a backslash "\". The value gets saved as intended without any additional escaping of backslashes. However, if I go to retrieve that same value with a where condition that includes the "\", the "\" gets escaped with "\\" and the where condition doesn't match and there is no way of turning that off so that value can be matched. A workaround is to simply do a raw query but I could see this potentially causing others problems. The reason is because of Mysqli::real_escape_string method is escaping "\" with an additional "\" which is being called from Query::matchNamedBinds (line 409).

Side note (and I realize I'm cramming 2 issues into one and should probably do a pull request... but this is minor), this is missing from the Model class at the top.

use CodeIgniter\Database\Exceptions\DatabaseException;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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