Edit report at https://bugs.php.net/bug.php?id=63726&edit=1

 ID:                 63726
 Updated by:         dmi...@php.net
 Reported by:        m...@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:        dmitry
+Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

The patch looks good. Please commit it into 5.3 and above.


Previous Comments:
------------------------------------------------------------------------
[2012-12-10 10:58:05] m...@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] larue...@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] larue...@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

------------------------------------------------------------------------
[2012-12-09 13:08:38] larue...@php.net

dmitry, could you review this patch please? thanks

------------------------------------------------------------------------
[2012-12-09 13:07:37] larue...@php.net

The following patch has been added/updated:

Patch Name: bug63726.patch
Revision:   1355058457
URL:        
https://bugs.php.net/patch-display.php?bug=63726&patch=bug63726.patch&revision=1355058457

------------------------------------------------------------------------


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

Reply via email to