News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans' Blog:
Overloaded properties (__get)
November 17, 2006 @ 08:43:00

While testing the eZ components framework on the latest version of PHP (PHP 5.2), Derick Rethans noticed a problem - a new "Notice" message appearing related to a __get call.

The first issue is an extra notice in some cases. This all works 'fine' with PHP 5.1, however with PHP 5.2 the [following] notice was generated for this code.

The cause? Well, the magic function __get only returns the variables in read mode so they cannot be written to. In Derick's situation, there was a foreach that was trying to use the values in a read/write mode. As a result, the error was tossed. He does provide a workaround, though, involving casting the information into an array.

0 comments voice your opinion now!
magic method function get error notice fatal cast array magic method function get error notice fatal cast array


blog comments powered by Disqus

Similar Posts

Brian DeShong's Blog: Small news that's big to me: my PHP Testfest submissions made it into 5_3!

EdFinkler's Blog: Determining if a function is *really* available in PHP

Derick Rethans' Blog: Overloaded properties (__get)

Matt Farina's Blog: SplFixedArray, An Underutilized PHP Gem

Symfony Blog: New in symfony 1.2: Small things matter (2)


Community Events





Don't see your event here?
Let us know!


developer podcast configure list framework unittest language install interview community release testing series wordpress opinion laravel code threedevsandamaybe refactor introduction

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