php.net |  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:
Package:
Bug Type:
Summary:
From: chad at herballure dot com
New email:
PHP Version: OS:

 

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

Reproduce code:
---------------
<?php
$data = array('a' => 12);
$data['bad'] =& $data;
var_dump(json_encode($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) ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC