Edit report at https://bugs.php.net/bug.php?id=63726&edit=1
ID: 63726
Updated by: laruence@php.net
Reported by: mike@php.net
Summary: Memleak with static properties and internal/user
classes
Status: Assigned
Type: Bug
Package: Scripting Engine problem
Operating System: Arch Linux
PHP Version: Irrelevant
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
@mike according your new comment, I updated the patch.
it should only occurred in zts version.
Previous Comments:
------------------------------------------------------------------------
[2012-12-10 11:30:37] laruence@php.net
The following patch has been added/updated:
Patch Name: bug63726.patch
Revision: 1355139037
URL: https://bugs.php.net/patch-display.php?bug=63726&patch=bug63726.patch&revision=1355139037
------------------------------------------------------------------------
[2012-12-10 11:11:55] dmitry@php.net
The patch looks good. Please commit it into 5.3 and above.
------------------------------------------------------------------------
[2012-12-10 10:58:05] mike@php.net
Yes, this should be fine.
But! :) There seems to be a similar problem with instance properties:
<?php
class MyClient extends http\Curl\Client {}
class MyPool extends http\Curl\Client\Pool {}
class MyShare extends http\Curl\Client\DataShare {}
class MyFactory extends http\Client\Factory {
protected $driver = "curl";
protected $persistentHandleId = "My";
protected $clientClass = "MyClient";
protected $clientPoolClass = "MyPool";
protected $clientDataShareClass = "MyShare";
protected $dummy = "foo";
}
[Mon Dec 10 11:54:43 2012] Script: '/home/mike/build/php-5.4-dbg-zts-
gcov/f.php'
/home/mike/src/php-5.4-workdir/Zend/zend_compile.c(3455) : Freeing
0x7F45B70B1B78 (5 bytes), script=/home/mike/build/php-5.4-dbg-zts-gcov/f.php
/home/mike/src/php-5.4-workdir/Zend/zend_variables.c(123) : Actual location
(location was relayed)
[Mon Dec 10 11:54:43 2012] Script: '/home/mike/build/php-5.4-dbg-zts-
gcov/f.php'
/home/mike/src/php-5.4-workdir/Zend/zend_compile.c(3454) : Freeing
0x7F45B70B1FC8 (32 bytes), script=/home/mike/build/php-5.4-dbg-zts-gcov/f.php
Last leak repeated 4 times
=== Total 6 memory leaks detected ===
------------------------------------------------------------------------
[2012-12-10 02:39:16] laruence@php.net
the problem is because when doing inherit, default static members will become
reference between parent / child.
I am not sure, is this a expect behavior(http_cookie is derived class of
http_object):
<?php
http\Object::setDefaultErrorHandling(http\Object::EH_NORMAL);
var_dump(http\Object::getDefaultErrorHandling());
var_dump(http\Cookie::getDefaultErrorHandling());
?>
//output
int(0)
int(0)
------------------------------------------------------------------------
[2012-12-09 13:20:05] laruence@php.net
The following patch has been added/updated:
Patch Name: bug63726.patch
Revision: 1355059205
URL: https://bugs.php.net/patch-display.php?bug=63726&patch=bug63726.patch&revision=1355059205
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63726--
Edit this bug report at https://bugs.php.net/bug.php?id=63726&edit=1