php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46106 Memory leaks when using global statement
Submitted: 2008-09-17 14:47 UTC Modified: 2008-09-17 15:12 UTC
From: felipe@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-09-17 (CVS) OS:
Private report: No CVE-ID: None
 [2008-09-17 14:47 UTC] felipe@php.net
Description:
------------
See below.

Reproduce code:
---------------
<?php

$foo = array(1);

function foobar($errno, $errstr, $errfile, $errline) { }

set_error_handler('foobar');

function test($x) {
	global $foo;

	$x->invokeArgs(array(0));
}

$x = new ReflectionFunction('str_pad');
test($x);

Actual result:
--------------
/home/felipe/dev/php5/Zend/zend_vm_execute.h(4047) :  Freeing 0x08C23230 (20 bytes), script=/home/felipe/public_html/bug.php
[Wed Sep 17 11:46:07 2008]  Script:  '/home/felipe/public_html/bug.php'
/home/felipe/dev/php5/Zend/zend_vm_execute.h(4078) :  Freeing 0x08C2392C (35 bytes), script=/home/felipe/public_html/bug.php
/home/felipe/dev/php5/Zend/zend_hash.c(388) : Actual location (location was relayed)
[Wed Sep 17 11:46:07 2008]  Script:  '/home/felipe/public_html/bug.php'
/home/felipe/dev/php5/Zend/zend_vm_execute.h(4092) :  Freeing 0x08C24150 (32 bytes), script=/home/felipe/public_html/bug.php
/home/felipe/dev/php5/Zend/zend_alloc.c(2391) : Actual location (location was relayed)
Last leak repeated 1 time
[Wed Sep 17 11:46:07 2008]  Script:  '/home/felipe/public_html/bug.php'
/home/felipe/dev/php5/Zend/zend_execute.c(737) :  Freeing 0x08C241A0 (20 bytes), script=/home/felipe/public_html/bug.php
[Wed Sep 17 11:46:07 2008]  Script:  '/home/felipe/public_html/bug.php'
/home/felipe/dev/php5/Zend/zend_vm_execute.h(482) :  Freeing 0x08C258B4 (20 bytes), script=/home/felipe/public_html/bug.php
=== Total 6 memory leaks detected ===


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-17 15:12 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: Tue Mar 19 10:01:30 2024 UTC