<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 07 Oct 2008 06:18:24 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Tobias Schlitt's Blog: Reflecting private properties]]></title>
      <guid>http://www.phpdeveloper.org/news/9645</guid>
      <link>http://www.phpdeveloper.org/news/9645</link>
      <description><![CDATA[<p>
<i>Tobias Schlitt</i> has <a href="http://schlitt.info/applications/blog/index.php?/archives/581-Reflecting-private-properties.html">posted a handy tip</a> about using the Reflection API in PHP5 - specifically its accessing of private properties in a class.
</p>
<blockquote>
I recently stumbled over reflecting private properties in PHP again. As you might know, this was not possible until now and if you tried this [code] PHP thanked it to you with this [error that is cannot access a non-public member].
</blockquote>
<p>
He notes that, while the <a href="http://schlitt.info/applications/blog/index.php?/archives/581-Reflecting-private-properties.html">behaviour is correct</a>, it still makes things like <a href="http://schlitt.info/applications/blog/exit.php?url_id=4456&entry_id=581">metaprogramming</a> impossible. So, what's a developer to do? Patch it of course! <i>Tobias</i> and <i>Derick Rethans</i> persuaded two other developers  (<i>Derick</i> and <i>Marcus Borger</i>) to include a patch that allows the Reflection API to see these private variables.
</p>
<p>
To make it work, you have to use the setAccessible method on the Reflection object to set which of the properties you want to be able to get at.
</p>]]></description>
      <pubDate>Fri, 15 Feb 2008 12:02:00 -0600</pubDate>
    </item>
  </channel>
</rss>
