News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
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



Similar Posts

Zend Developer Zone: Zend Framework Gets An Unofficial PEAR Channel

Zend Developer Zone: OSCON '07 Wrapup

IBM developerWorks: PHP frameworks, Part 1: Getting started with three popular frameworks

Paul Jones' Blog: Solar 0.23.0 Released

Riff Blog: Multiple entries with Zend_Config_XML


Community Events











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


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

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