On Sat, Apr 27, 2013 at 1:19 PM, Remi Collet <r...@fedoraproject.org> wrote:
> Trying to solve https://bugs.php.net/bug.php?id=63520 > > I start to work on a dropin alternative for current json extension in php. > > > Current work: > https://github.com/remicollet/pecl-json-c > > > It is obviously to late for PHP 5.5, and need probably more feedback, > more tests, and more work before a RFC for PHP 5.6 (or later). > > * json_encode : same code than php 5.5, no difference > > * json_decode : wrapper over json-c 0.11 library. > > Difference: > - error code returned by the parser are different. > - number only parse as integer (no automatic cast to double) > I guess we could use zend_strtod() for that. > - loose of performance (but still acceptable, I think) > > New feature: as json-c is an incremental parser, a new class is > available to allow incremental parsing (for large json encoded data) > > $parser = new JsonIncrementalParser(); > $fic = fopen("somefile.json", "r"); > do { > $buf = fgets($fic); > $ret=$parser->parse($buf); > } while ($buf && > ($ret==JsonIncrementalParser::JSON_PARSER_CONTINUE)); > $result = $parser->get(); > > Still TODO: windows build stuff. > > Proposal: > > update the existing pecl/json extension > or create a new pecl/json-c extension > > Julien.Pauli