|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-12-08 10:54 UTC] mike@php.net
Description:
------------
There may occur memory leaks, if a user class extends an internal class with
modified static properties:
█ ~/build/php-5.4-dbg-zts-gcov$ sapi/cli/php -r
'http\Object::setDefaultErrorHandling(http\Object::EH_NORMAL);'
█ ~/build/php-5.4-dbg-zts-gcov$ sapi/cli/php -r
'http\Object::setDefaultErrorHandling(http\Object::EH_NORMAL); class eh extends
http\Object{}'
[Sat Dec 8 11:50:14 2012] Script: '-'
/home/mike/src/php-5.4-workdir/Zend/zend_API.c(3756) : Freeing 0x7FC747BCE318
(32 bytes), script=-
=== Total 1 memory leaks detected ===
http\Object::setDefaultErrorHandling() just does a
zend_update_static_property_long()
Test script:
---------------
<?php
http\Object::setDefaultErrorHandling(http\Object::EH_NORMAL);
class eh extends http\Object{}
Expected result:
----------------
<no output>
Actual result:
--------------
[Sat Dec 8 11:50:14 2012] Script: '-'
/home/mike/src/php-5.4-workdir/Zend/zend_API.c(3756) : Freeing 0x7FC747BCE318
(32 bytes), script=-
=== Total 1 memory leaks detected ===
Patchesbug63726.patch (last revision 2012-12-10 11:30 UTC by laruence@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 10 07:00:01 2025 UTC |
compile error: In file included from /home/huixinchen/local/php54- zts//include/php/main/php_ini.h:24, from /home/huixinchen/local/php54- zts//include/php/main/fopen_wrappers.h:26, from /home/huixinchen/local/php54- zts//include/php/main/php.h:398, from /home/huixinchen/opensource/pecl/http/branches/DEV_2/php_http_api.h:23, from /home/huixinchen/opensource/pecl/http/branches/DEV_2/php_http_curl_client.c:16: /home/huixinchen/local/php54-zts//include/php/Zend/zend_ini.h:81: error: expected ‘)’ before ‘*’ token /home/huixinchen/local/php54-zts//include/php/Zend/zend_ini.h:82: warning: no semicolon at end of struct or union /home/huixinchen/local/php54-zts//include/php/Zend/zend_ini.h:94: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ tokenYes, 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 ===