<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 08:57: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/DCOM-175/DCOM-175.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>[DCOM-175] Proxies return private properties in __sleep, which is not supported by PHP.</title>
                <link>http://www.doctrine-project.org/jira/browse/DCOM-175</link>
                <project id="10043" key="DCOM">Doctrine Common</project>
                        <description>&lt;p&gt;__sleep should not return private parent property names (see &lt;a href=&quot;http://php.net/__sleep&quot; class=&quot;external-link&quot;&gt;http://php.net/__sleep&lt;/a&gt;) this raises notices, and also results in the value of the property being &apos;N&apos; (null) instead of keeping its value.&lt;/p&gt;

&lt;p&gt;I am unfortunately stuck having to serialize proxies in my revision tracking, as doctrine seems to be currently ignoring the fetch=&quot;EAGER&quot; I set on the related properties.&lt;/p&gt;

&lt;p&gt;Proxies should use the Serializable interface, and not __sleep, or not return parent property names which are private, it serves no purpose, and is not supported by PHP itself anyway.&lt;/p&gt;

&lt;p&gt;Also, if you keep __sleep, but do not return the parent property names, then it will only include the items you return, so it would be better to simply drop the __sleep method, I cannot actually see any useful purpose it serves.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13562">DCOM-175</key>
            <summary>Proxies return private properties in __sleep, which is not supported by PHP.</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="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="ocramius">Marco Pivetta</assignee>
                                <reporter username="bittarman">Ryan Mauger</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Mar 2012 13:25:56 +0000</created>
                <updated>Fri, 19 Apr 2013 12:06:43 +0000</updated>
                                    <version>2.4</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17663" author="bittarman" created="Tue, 27 Mar 2012 13:32:12 +0000"  >&lt;p&gt;just updated the issue body, realised that I worded something badly.&lt;/p&gt;</comment>
                    <comment id="19386" author="ocramius" created="Wed, 23 Jan 2013 22:29:56 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=bittarman&quot; class=&quot;user-hover&quot; rel=&quot;bittarman&quot;&gt;Ryan Mauger&lt;/a&gt; I think that&apos;s a limitation we have. We use `__sleep` to avoid serializing fields like the initializers and the persisters of course.&lt;/p&gt;

&lt;p&gt;Even by implementing serializable, it would only work if the end user implemented it in the parent class.&lt;/p&gt;

&lt;p&gt;Tempted to mark it as &quot;can&apos;t fix&quot;&lt;/p&gt;</comment>
                    <comment id="19397" author="ocramius" created="Thu, 24 Jan 2013 08:59:23 +0000"  >&lt;p&gt;I think there&apos;s a solution by having something like following:&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;
class SomeGeneratedProxyName &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; RealName &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; \Serializable
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function unserialize($data)
    {
        $reflectionClass = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ReflectionClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
        foreach ($reflectionClass-&amp;gt;getProperties(ReflectionProperty::IS_PRIVATE) as $privateProp) {
            $privateProp-&amp;gt;setAccessible(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
            $privateProp-&amp;gt;setValue($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;, $data[$privateProp-&amp;gt;getName()]);
        }
        &lt;span class=&quot;code-comment&quot;&gt;// ... other props ...
&lt;/span&gt;    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function serialize()
    {
        $data = array();
        $reflectionClass = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ReflectionClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
        foreach ($reflectionClass-&amp;gt;getProperties(ReflectionProperty::IS_PRIVATE) as $privateProp) {
            $privateProp-&amp;gt;setAccessible(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
            $data[$privateProp-&amp;gt;getName()] = $privateProp-&amp;gt;getValue($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
        }
        &lt;span class=&quot;code-comment&quot;&gt;// ... other props ...
&lt;/span&gt;        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $data;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19676" author="ocramius" created="Sat, 23 Feb 2013 03:15:26 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=bittarman&quot; class=&quot;user-hover&quot; rel=&quot;bittarman&quot;&gt;Ryan Mauger&lt;/a&gt; I started implementing this one at &lt;a href=&quot;https://github.com/Ocramius/common/compare/hotfix;DCOM-175&quot; class=&quot;external-link&quot;&gt;https://github.com/Ocramius/common/compare/hotfix;DCOM-175&lt;/a&gt; and so far it looks promising. &lt;/p&gt;

&lt;p&gt;The only doubts so far are with handling cases like following:&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;
class MyEntity &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; Serializable
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function serialize()
    {
        &lt;span class=&quot;code-comment&quot;&gt;// [...]
&lt;/span&gt;    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function unserialize($serialized)
    {
        &lt;span class=&quot;code-comment&quot;&gt;// [...]
&lt;/span&gt;    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __sleep()
    {
        &lt;span class=&quot;code-comment&quot;&gt;// [...]
&lt;/span&gt;    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __wakeup()
    {
        &lt;span class=&quot;code-comment&quot;&gt;// [...]
&lt;/span&gt;    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;So far I didn&apos;t get to write tests that demonstrate the exact behaviour for this case, but it looks like when `Serializable` is implemented, `_&lt;em&gt;sleep` and `&lt;/em&gt;_wakeup` are ignored. Any thoughts on this?&lt;/p&gt;</comment>
                    <comment id="20067" author="ocramius" created="Fri, 19 Apr 2013 12:06:43 +0000"  >&lt;p&gt;A possible solution is to use something like &lt;a href=&quot;http://eval.in/16806&quot; class=&quot;external-link&quot;&gt;http://eval.in/16806&lt;/a&gt;, and thus exploiting the ability of php to retrieve an object&apos;s private properties by using the special &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;chr(0) . &apos;Foo&apos; . chr(0) . &apos;bar&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;trick.&lt;/p&gt;

&lt;p&gt;This can be abstracted by using &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;array_keys((array) $object);&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;, which retrieves also those special keys&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>