<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 17:25:51 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DC-727/DC-727.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DC-727] ReOpen DC-46 - Unexpected behavior with whereIn() and empty array</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-727</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;I reopen the &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-46&quot; title=&quot;Unexpected behavior with whereIn() and empty array&quot;&gt;&lt;del&gt;DC-46&lt;/del&gt;&lt;/a&gt; as it&apos;seems not fix at all. &lt;br/&gt;
When I do a whereIn with empty array, the condition is just drop and I get no Exception.&lt;/p&gt;

&lt;p&gt;Here is a simple test case:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;require_once(&apos;doctrine/lib/Doctrine.php&apos;);
spl_autoload_register(array(&apos;Doctrine&apos;, &apos;autoload&apos;));
$manager = Doctrine_Manager::getInstance();
$manager-&amp;gt;setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
$conn = Doctrine_Manager::connection(&apos;mysql:&lt;span class=&quot;code-comment&quot;&gt;//root:root@localhost/test_doctrine&apos;);
&lt;/span&gt;echo &lt;span class=&quot;code-quote&quot;&gt;&quot;Connection is set up\n&quot;&lt;/span&gt;;

class Record &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Doctrine_Record {
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setTableDefinition(){
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;setTableName(&apos;record&apos;);
    }
}

&lt;span class=&quot;code-comment&quot;&gt;// Create the db
&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt; {Doctrine::dropDatabases();}&lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt;(Exception $e){} &lt;span class=&quot;code-comment&quot;&gt;// Drop &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; exist :-)
&lt;/span&gt;Doctrine::createDatabases();Doctrine::createTablesFromArray(array(&apos;Record&apos;));

&lt;span class=&quot;code-comment&quot;&gt;// Test
&lt;/span&gt;echo Doctrine::getTable(&apos;Record&apos;)-&amp;gt;createQuery()-&amp;gt;select(&apos;id&apos;)-&amp;gt;whereIn(&apos;id&apos;, array())-&amp;gt;getSqlQuery() , &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
echo Doctrine::getTable(&apos;Record&apos;)-&amp;gt;createQuery()-&amp;gt;select(&apos;id&apos;)-&amp;gt;whereIn(&apos;id&apos;, array())-&amp;gt;fetchArray() , &lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;;

&lt;span class=&quot;code-comment&quot;&gt;// Result is:
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// SELECT r.id AS r__id FROM record r
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// Array&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22) &lt;br/&gt;
mysql Ver 14.14 Distrib 5.1.41, for apple-darwin9.5.0 (i386) using readline 5.1 &lt;br/&gt;
Doctrine version 1.2.2 from SVN: &lt;a href=&quot;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&quot;&gt;http://doctrine.mirror.svn.symfony-project.com/tags/1.2.2/lib/Doctrine.php&lt;/a&gt;</environment>
            <key id="11473">DC-727</key>
            <summary>ReOpen DC-46 - Unexpected behavior with whereIn() and empty array</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="jeanmonod">David Jeanmonod</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Jun 2010 02:45:58 +0000</created>
                <updated>Wed, 12 Oct 2011 10:45:42 +0000</updated>
                                    <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                                                <component>Query</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="13334" author="gx" created="Wed, 16 Jun 2010 07:41:36 +0000"  >&lt;p&gt;The problem is that the change for &quot;new&quot; behavior (throw exception instead of return unchanged query) was only done in _&lt;em&gt;processWhereIn()&lt;/em&gt; but not cascaded to &lt;em&gt;andWhereIn()&lt;/em&gt; and &lt;em&gt;orWhereIn()&lt;/em&gt; (another example we should avoid code duplication).&lt;br/&gt;
The patch is simple, &lt;b&gt;but&lt;/b&gt; it causes &lt;em&gt;Doctrine_Ticket_1558_TestCase&lt;/em&gt; to fail. Indeed that (old) test expects the &quot;old&quot; behavior (return unchanged query, don&apos;t throw exception)... So the 2 fixes are incompatible, you&apos;ll have to choose :/&lt;/p&gt;

&lt;p&gt;I still attach a new test case and 2 versions of a patch (the first one just applies changes of _processWhereIn also to the 2 other functions but adds more duplicate code, the second is a little refactored and seems better to me).&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;</comment>
                    <comment id="13335" author="gx" created="Wed, 16 Jun 2010 07:51:37 +0000"  >&lt;p&gt;added a more specific test case (expects Doctrine_Query_Exception instead of simple Exception)&lt;/p&gt;</comment>
                    <comment id="14799" author="dracoblue" created="Mon, 22 Nov 2010 05:36:33 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;the issue is still present in 1.2.3. Are there any plans to apply it?&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;/p&gt;</comment>
                    <comment id="16575" author="jimpersson" created="Wed, 12 Oct 2011 10:45:42 +0000"  >&lt;p&gt;I would like to add that this also applies to delete-queries which can cause serious data loss.&lt;br/&gt;
We had a case where a table of serialized data was completely emptied which caused a database cascade that deleted quite a lot of data.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10659" name="DC-727_refactored.patch" size="2116" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10658" name="DC-727_with_duplicates.patch" size="1879" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10657" name="DC727TestCase.php" size="1321" author="gx" created="Wed, 16 Jun 2010 07:42:29 +0000" />
                    <attachment id="10660" name="DC727TestCase_more_specific.php" size="1459" author="gx" created="Wed, 16 Jun 2010 07:51:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>