Doctrine 1
  1. Doctrine 1
  2. DC-945

Doctrine_Query::create()->where('table.field =') unexpectedly returns a result

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP 5.3.0

      Description

      While firing the following query with Doctrine, I did not expect Doctrine to return me a record, however, even though there is a syntax error (in my opinion) it gave me the first record of the table.

      $q = \Doctrine_Query::create()
      ->from('User u')
      ->where('u.Id =', $userId);

      $r = $q->fetchOne();

      Note that the question mark in the where method is ommitted. This will return a User model with an Id of 1.

      I would expect this to generate an invalid SQL statement (or even fail to pass the DQL validation).

      Giving the first record doesn't seem to be appropriate in my opinion.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            John Huijbers
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: