[TYPO3-core] contrib/json.php vs PHP json_encode

Oliver Hader oh at inpublica.de
Wed Sep 5 09:50:04 CEST 2007


Hi Masi,

Martin Kutschker schrieb:
> In t3lib_div.php there is now a array2json() that makes use of a
> JSON-class. How does this class compare to PHP 5.2's json_encode?
> 
> Maybe we can add some helper code for PHP 5.0 and 5.1 that load this
> class only when json_encode is not present. We did something like that
> for clone().

Yes, this was discussed in "RFC: Moving t3lib_TCEforms_inline::getJSON()
to t3lib_div::array2json()" on this list. Since there might be some
Linux distributors that ship with PHP 5.0/5.1 we decided to use the
"Services_JSON" class.

But your suggestion is fine, see the attached patch that uses
json_encode() if its available - otherwise Services_JSON is used.


olly
-- 
Oliver Hader
http://inpublica.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array2json.patch
Type: text/x-patch
Size: 1260 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070905/711551cb/attachment.bin 


More information about the TYPO3-team-core mailing list