News Feed
Sections




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

Cal Evans' Blog:
I called Zend_Jsonencode(), so WTH are all my properties?
February 22, 2008 @ 12:10:00

In dealing with a little JSON encoding and objects in a project of his recently, Cal Evans bumped against a problem when he was encoding an object and moving it back and forth between the back and front ends.

The problem is simple, JSON encode a PHP object and send it back to the front end. Sounds simple and the last 100 times I wrote this code it was simple. This time, I was too smart for my own good. Here's the scenario.

He illustrates his problem - the "dropping" of properties somewhere along the way - with a sample class that encodes the object and sends it along. He missed one key bit of information, though. His protected array of properties wasn't getting passed back out correctly and we're in the resulting JSON message. A quick hack of a getProperties() function call made this problem a thing of the past.

0 comments voice your opinion now!
zendframework json encode property getproperties problem


blog comments powered by Disqus

Similar Posts

Developer Tutorials Blog: Zend Framework: The Best Framework for Use With Other Frameworks

Davey Shafik's Blog: Mini-Review: Zend Guard vs IonCube PHP Encoder

Till Klampaeckel's Blog: Zend Framework: Slow automatic view rendering

Stefan Koopmanschap's Blog: Adding a link to a form element with Zend Framework

Rob Allen's Blog: Zend Framework's Flash Messenger action helper


Community Events





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


framework opinion version conference unittest release list series threedevsandamaybe configure podcast interview composer community symfony voicesoftheelephpant introduction language laravel api

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