|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61359 [PATCH] json_encode() calls too many reallocs
Submitted: 2012-03-12 14:35 UTC Modified: 2012-07-01 02:15 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Assigned: stas
Status: Closed Package: json (PECL)
PHP Version: 5.4SVN-2012-03-12 (SVN) OS: Linux x86_64 2.6.32-38-generic
Private report: No CVE-ID:
 [2012-03-12 14:35 UTC]
json_encode() produces many reallocations in the string escaping code

It is highly likely that escaping a string will produce a string at least as long as the original string - the current code reallocs every 128 bytes.


json.c.diff (last revision 2012-03-12 14:35 UTC) by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-12 14:35 UTC]
The following patch has been added/updated:

Patch Name: json.c.diff
Revision:   1331562942
 [2012-03-12 14:37 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: stas
 [2012-03-12 14:37 UTC]
Dos it look for 5.4? Tests pass.
 [2012-07-01 02:15 UTC]
Automatic comment on behalf of stas
Log: fix bug #61359: json_encode() calls too many reallocs
 [2012-07-01 02:15 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2012-07-01 02:15 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 15:01:54 2014 UTC