From 67b89eaa4f46348cdca71d92bebd0118b67aaf87 Mon Sep 17 00:00:00 2001
From: Benjamin Eberlei <kontakt@beberlei.de>
Date: Sat, 30 Apr 2011 12:27:16 +0200
Subject: [PATCH] [DDC-1108] Fix bug with single char named input parameters in
 DQL lexer.

---
 lib/Doctrine/ORM/Query/Lexer.php                          | 2 +-
 .../Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php  | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/Doctrine/ORM/Query/Lexer.php b/lib/Doctrine/ORM/Query/Lexer.php
index 673ab0205..82355faec 100644
--- a/lib/Doctrine/ORM/Query/Lexer.php
+++ b/lib/Doctrine/ORM/Query/Lexer.php
@@ -126,7 +126,7 @@ class Lexer extends \Doctrine\Common\Lexer
             '[a-z_\\\][a-z0-9_\:\\\]*[a-z0-9_]{1}',
             '(?:[0-9]+(?:[\.][0-9]+)*)(?:e[+-]?[0-9]+)?',
             "'(?:[^']|'')*'",
-            '\?[1-9][0-9]*|:[a-z][a-z0-9_]+'
+            '\?[1-9][0-9]*|:[a-z]{1}[a-z0-9_]{0,}'
         );
     }
     
diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
index 1ac05df90..8dccd2cba 100644
--- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
+++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
@@ -513,6 +513,14 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
         $this->assertInvalidDQL('SELECT g FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.groups g');
     }
 
+    /**
+     * @group DDC-1108
+     */
+    public function testInputParameterSingleChar()
+    {
+        $this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = :q');
+    }
+
     /**
      * @group DDC-1053
      */