php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39093 several leaks appear when changing the result of __get()
Submitted: 2006-10-09 13:41 UTC Modified: 2007-12-28 14:10 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: tony2001@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.0RC5 OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tony2001@php.net
New email:
PHP Version: OS:

 

 [2006-10-09 13:41 UTC] tony2001@php.net
Description:
------------
Several leaks appear in the reproduce code.
The code itself is quite weird (and cannot work), but still..

Reproduce code:
---------------
<?php
class test { 
public function __get($var) {} 
} 
$test = new test(); 
$test->a["b"]["c"] = "";
?>

Expected result:
----------------
Notice: Indirect modification of overloaded property test::$a has no effect in ..

Actual result:
--------------
==10186== 146 (16 direct, 130 indirect) bytes in 1 blocks are definitely lost in loss record 1 of 2
==10186==    at 0x401C4CE: malloc (vg_replace_malloc.c:149)
==10186==    by 0x8160629: _emalloc (zend_alloc.c:1637)
==10186==    by 0x8196FFA: zend_fetch_dimension_address (zend_execute.c:1061)
==10186==    by 0x81ACD45: ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER (zend_vm_execute.h:9200)
==10186==    by 0x8197AF0: execute (zend_vm_execute.h:92)
==10186==    by 0x816E8FF: zend_eval_string (zend_execute_API.c:1137)
==10186==    by 0x816EA5F: zend_eval_string_ex (zend_execute_API.c:1171)
==10186==    by 0x81DEAC9: main (php_cli.c:1147)
==10186==
==10186==
==10186== 130 bytes in 5 blocks are indirectly lost in loss record 2 of 2
==10186==    at 0x401C4CE: malloc (vg_replace_malloc.c:149)
==10186==    by 0x8160629: _emalloc (zend_alloc.c:1637)
==10186==    by 0x817C1C1: _array_init (zend_API.c:819)
==10186==    by 0x8197081: zend_fetch_dimension_address (zend_execute.c:1065)
==10186==    by 0x81ACD45: ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER (zend_vm_execute.h:9200)
==10186==    by 0x8197AF0: execute (zend_vm_execute.h:92)
==10186==    by 0x816E8FF: zend_eval_string (zend_execute_API.c:1137)
==10186==    by 0x816EA5F: zend_eval_string_ex (zend_execute_API.c:1171)
==10186==    by 0x81DEAC9: main (php_cli.c:1147)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-09 13:43 UTC] tony2001@php.net
Dmitry made a patch which adds the notice: http://tony2001.phpclub.net/dev/tmp/bug39093.diff
It doesn't fix the leaks, though.
 [2006-10-09 22:03 UTC] judas dot iscariote at gmail dot vom
Tony why not a warning instead of a notice ?? 
that should be warning IMHO.
 [2006-10-09 22:15 UTC] tony2001@php.net
It's notice at the moment.
The main goal is to fix the leak, whether it should be notice or warning - it's another question.
 [2007-04-16 10:19 UTC] judas dot iscariote at gmail dot com
ping ! this leak still happends in 5.2.1RC2-dev , 

PHP Notice:  Indirect modification of overloaded property test::$a has no effect in /home/cristian/get.php on line 6

Notice: Indirect modification of overloaded property test::$a has no effect in /home/cristian/get.php on line 6
[Mon Apr 16 06:18:54 2007]  Script:  'get.php'
/home/cristian/php5/Zend/zend_variables.h(45) :  Freeing 0x00C789A0 (1 bytes), script=get.php
/home/cristian/php5/Zend/zend_variables.c(120) : Actual location (location was relayed)
[Mon Apr 16 06:18:54 2007]  Script:  'get.php'
/home/cristian/php5/Zend/zend_execute.c(1062) :  Freeing 0x00C789F8 (64 bytes), script=get.php
/home/cristian/php5/Zend/zend_alloc.c(2314) : Actual location (location was relayed)
Last leak repeated 1 time
[Mon Apr 16 06:18:54 2007]  Script:  'get.php'
/home/cristian/php5/Zend/zend_execute.c(1058) :  Freeing 0x00C78A90 (24 bytes), script=get.php
[Mon Apr 16 06:18:54 2007]  Script:  'get.php'
/home/cristian/php5/Zend/zend_execute.c(827) :  Freeing 0x00C7B3F8 (24 bytes), script=get.php
[Mon Apr 16 06:18:54 2007]  Script:  'get.php'
/home/cristian/php5/Zend/zend_hash.c(247) :  Freeing 0x00C7B508 (73 bytes), script=get.php
=== Total 6 memory leaks detected ===

ps: and it should be a warning ;-)
 [2007-12-28 14:10 UTC] dmitry@php.net
The bug seems to be fixed some time ago.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 08:00:02 2025 UTC