RSS DAILY NEWS TICKER EXAMPLE


home > overview

Cal Evans' Blog: I called Zend_Json::encode(), so WTH are all my properties?




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.




click here to see original article or to find similar articles

 RSS DAILY HEADLINES

HEADLINES

Edwards to emerge from seclusion for speech

Aug. 9: Jennifer Palmieri, former staffer for John Edwards tells NBC's Jenna Wolfe that Elizabeth Edwards knew about her husband's affair since 2006, and is relieved the news is now public. (Today Show)In a return to the public stage, John Edwards has confirmed plans to talk politics a month after admitting to an extramarital affair. But his wife won't be at his side.


Australian police clear Indian doctor of involvement in terror (AFP)

Indian doctor, Mohamed Haneef, at a press conference in Bangalore in early August. Australian police have cleared Haneef of involvement in failed bomb attacks in Britain last year after a bungled 14-month probe(AFP/File/Dibyangshu Sarkar)AFP - Australian police have cleared an Indian doctor of involvement in failed bomb attacks in Britain last year after a bungled 14-month probe that is now the subject of a judicial inquiry.


Consumer spending flags, but confidence rises (Reuters)

A shopper walks past a store display in New York July 1, 2008. (Lucas Jackson/Reuters)Reuters - Personal income tumbled unexpectedly in July and inflation-adjusted spending shrank as government economic stimulus waned, but consumer spirits rose this month, a hint the economy may muddle through its woes.



Find this article in Google