News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



feed this:

Tobias Schlitt's Blog:
Reflecting private properties
0 comments :: posted Friday February 15, 2008 @ 12:02:00
voice your opinion now!

Tobias Schlitt has posted a handy tip about using the Reflection API in PHP5 - specifically its accessing of private properties in a class.

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].

He notes that, while the behaviour is correct, it still makes things like metaprogramming impossible. So, what's a developer to do? Patch it of course! Tobias and Derick Rethans persuaded two other developers (Derick and Marcus Borger) to include a patch that allows the Reflection API to see these private variables.

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.

tagged with: reflection api setaccessible private properties


Stubbles Blog:
Do not trust the reflection API
0 comments :: posted Monday January 28, 2008 @ 13:07:00
voice your opinion now!

On the Stubbles blog, Frank Kleine offers some advice to developers looking to use the Reflection API - "don't trust it".

If you try to get informations about parameters from methods of internal classes - forget that. Examining several internal classes my key findings are: either there is no information about parameters available and the reflection API says the method does not have any parameters, or the information about the parameter is wrong.

He includes code examples along side the output from the script to illustrate his point.

tagged with: reflection api class external internal pdo pdostatement


mysql job book pecl conference releases zendframework framework release code database developer application PHP5 security zend cakephp package PEAR ajax

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework