|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57397 Infinite loop encoding circular structures
Submitted: 2006-11-27 16:02 UTC Modified: 2008-12-18 21:28 UTC
From: chad at herballure dot com Assigned:
Status: Closed Package: json (PECL)
PHP Version: 5.1.6 OS: SuSE 9.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chad at herballure dot com
New email:
PHP Version: OS:


 [2006-11-27 16:02 UTC] chad at herballure dot com
When asked to encode a circular data structure, json_encode does not notice.

Reproduce code:
$data = array('a' => 12);
$data['bad'] =& $data;

Expected result:
Some sort of error about object recursion, as this is not supported by JSON.

Actual result:
PHP Fatal error:  Allowed memory size of 25165824 bytes exhausted (tried to allocate 128 bytes) ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-29 11:47 UTC] chad at herballure dot com
Further research reveals this was fixed 4 months ago in CVS and for MAIN and PHP_5_2. Can we get a fresh PECL release?
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 02:05:53 2022 UTC