php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38469 json tests failed, leaks memory
Submitted: 2006-08-16 05:27 UTC Modified: 2007-12-28 13:38 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: judas dot iscariote at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.0RC1 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: judas dot iscariote at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-16 05:27 UTC] judas dot iscariote at gmail dot com
Description:
------------
Hi: the json extension test suite fails, because PHP leaks memory in

ext/json/tests/003.php
ext/json/tests/005.php

ps: ext/pdo/tests/bug_38394.phpt also fails.



Reproduce code:
---------------
tests json 003 and 005.

Expected result:
----------------
no memory leaks

Actual result:
--------------
013+ /local/local/bodegon/php-debug/Zend/zend_execute.c(838) :  Freeing 0x2B57DCDB9C18 (24 bytes), script=/local/local/bo    degon/php-debug/ext/json/tests/005.php^M
147 014+ [Wed Aug 16 01:23:03 2006]  Script:  '/local/local/bodegon/php-debug/ext/json/tests/005.php'^M
148 015+ /local/local/bodegon/php-debug/Zend/zend_vm_execute.h(18188) :  Freeing 0x2B57DCDBB168 (72 bytes), script=/local/loc
    al/bodegon/php-debug/ext/json/tests/005.php^M
149 016+ /local/local/bodegon/php-debug/Zend/zend_API.c(819) : Actual location (location was relayed)^M                      150 017+ Last leak repeated 1 time^M
151 018+ [Wed Aug 16 01:23:03 2006]  Script:  '/local/local/bodegon/php-debug/ext/json/tests/005.php'^M
152 019+ /local/local/bodegon/php-debug/Zend/zend_execute.c(1079) :  Freeing 0x2B57DCDBB318 (71 bytes), script=/local/local/b
    odegon/php-debug/ext/json/tests/005.php^M
153 020+ /local/local/bodegon/php-debug/Zend/zend_hash.c(383) : Actual location (location was relayed)^M                     154 021+ === Total 4 memory leaks detected ===

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-13 13:37 UTC] dmitry@php.net
ext/json/tests/003.php is not really the problem. It just uses circular data structure and leaks are expected. 

The real problem that the following code creates broken circular data structure. It shouldn't create circular data ctructure at all.

Reproduce code:
---------------
<?php
$a = array();
$a[] = $a;
var_dump($a);
?>

Expected result:
----------------
array(1) {
  [0]=>
  array(0) {
  }
}

Actual result:
--------------
array(1) {
  [0]=>
  array(1) {
    [0]=>
    *RECURSION*
  }
}
[Wed Sep 13 17:31:32 2006]  Script:  '-'
/home/dmitry/php/php5.2/Zend/zend_execute.c(838) :  Freeing 0xB7F4FFF0 (16 bytes), script=-
[Wed Sep 13 17:31:32 2006]  Script:  '-'
/home/dmitry/php/php5.2/Zend/zend_vm_execute.h(18054) :  Freeing 0xB7F50A60 (44 bytes), script=-
/home/dmitry/php/php5.2/Zend/zend_API.c(819) : Actual location (location was relayed)
Last leak repeated 1 time
[Wed Sep 13 17:31:32 2006]  Script:  '-'
/home/dmitry/php/php5.2/Zend/zend_execute.c(1079) :  Freeing 0xB7F50AF4 (35 bytes), script=-
/home/dmitry/php/php5.2/Zend/zend_hash.c(383) : Actual location (location was relayed)
=== Total 4 memory leaks detected ===

The reason of this bug is IS_CV variables that changed default order of operand fetches.

 [2007-12-28 13:38 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 13:01:30 2024 UTC