News Feed
Sections




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

Christian Weiske:
PHP Cannot access property started with '\o'
November 08, 2013 @ 09:59:13

Christian Weiske had an interesting situation pop up in one of his applications around a call to a variable with an interesting name.

Some days ago I saw the following fatal error for the first time in my life:

Fatal error: Cannot access property started with 'o' in file.php

After some debugging, I found out that the source of the error was not some strange BOM or UTF-8 characters in PHP source code files. No, it was a combination of protected class properties, object-to-array casting and automatic template property mappings.

As it turns out, there was a change in how object-to-array casting was done in PHP 5.3 that made this break (related to things appended to private and protected variable names). He includes a bit of sample code to illustrate the problem - a simple class converted from object to array with direct casting. He does point out that it doesn't happen with get_object_vars, though, as that doesn't do the casting, just extraction.

0 comments voice your opinion now!
class property special character private protected casting

Link: http://cweiske.de/tagebuch/php-property-started-nul.htm

blog comments powered by Disqus

Similar Posts

Felix Geisendorfer's Blog: Assert the yummyness of your cake

Jordi Boggiano's Blog: Multiton base class

DevShed: Using Yahoo Web Services to Perform Searches with an Object-Oriented Approach

Matthew Weir O'Phinney's Blog: Extending Singletons

Andrei Zmievski's Blog: All the Little Pieces, or TextIterator in PHP 6


Community Events

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


performance series php7 voicesoftheelephpant version library api introduction community release laravel example interview xdebug conference podcast framework opinion extension symfony2

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