Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2544

[GH-717] Allow query parameters starting with an underscore

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of hackedd:

      Url: https://github.com/doctrine/doctrine2/pull/717

      Message:

      Using a query parameter of which the name starts with an underscore results in a QueryException. For example:

      ``` php
      $q = $em->createQueryBuilder()
      ->select("u")
      ->from("User", "u")
      ->where("u.username = :_name")
      ->setParameter("_name", "bar")
      ->getQuery();
      ```

      Results in:

      Invalid parameter format, : given, but :<name> or ?<num> expected.

      This happens because of a bug in the Lexer, which recognizes `:_name` as two tokens (the `:` as the start of a input parameter, `_name` as an identifier). The attached patch changes the regular expression for input parameters to allow identifiers starting with a letter or underscore.

        Activity

        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-717] was closed:
        https://github.com/doctrine/doctrine2/pull/717

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-717] was closed: https://github.com/doctrine/doctrine2/pull/717
        Show
        Fabio B. Silva added a comment - Merged : https://github.com/doctrine/doctrine2/commit/a53fe14fa254618bc9a67296f845ec4923a13606

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: