php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26900 Memory leak when passing arguments to __clone()
Submitted: 2004-01-13 18:38 UTC Modified: 2004-02-04 20:02 UTC
From: adam at trachtenberg dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-01-26 OS: *
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: adam at trachtenberg dot com
New email:
PHP Version: OS:

 

 [2004-01-13 18:38 UTC] adam at trachtenberg dot com
Description:
------------
Passing arguments to __clone() causes a memory leak. (I 
know this is invalid.)

Reproduce code:
---------------
class foo {
    function __clone() {}
}

$a = new foo;
$b = $a->__clone('bad argument');

Expected result:
----------------
No leaks.

Actual result:
--------------
PHP Warning:  Clone method does not require arguments in 
/Users/adam/php5/clone.php on line 8
/usr/local/cvs/php/php-src/Zend/zend_execute.c(2817) :  
Freeing 0x00B98C30 (16 bytes), script=./clone.php
/usr/local/cvs/php/php-src/Zend/zend_execute.c(2820) :  
Freeing 0x00B98AD0 (13 bytes), script=./clone.php
/usr/local/cvs/php/php-src/Zend/zend_variables.c(137) : 
Actual location (location was relayed)
=== Total 2 memory leaks detected ===

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-04 20:02 UTC] helly@php.net
__clone cannot be callled directly any longer and when using the new clone keyword you cannot pass parameters.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 19 19:00:03 2025 UTC