php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70179 $this refcount issue
Submitted: 2015-07-31 21:32 UTC Modified: 2015-07-31 22:49 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: marcio dot web2 at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta2 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: marcio dot web2 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-07-31 21:32 UTC] marcio dot web2 at gmail dot com
Description:
------------
This is probably related to refcount of $this that happens only when the object is invoked as a closure:

http://3v4l.org/7PZip

When there is an assignment the same problem does not occurs:

http://3v4l.org/deLUQ

Test script:
---------------
<?php

class X {
    function __invoke() {
        var_dump($this);
    }
}

(new X)();

Expected result:
----------------
object(X)#1 (0) {
}

Actual result:
--------------
*RECURSION*


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-01 18:36 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2d6f0e4584375c90a895fed4074d579f364aa347
Log: Fix bug #70179 ($this refcount issue)
 [2015-08-01 18:36 UTC] bwoebi@php.net
-Status: Open +Status: Closed
 [2015-08-04 20:54 UTC] ab@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2d6f0e4584375c90a895fed4074d579f364aa347
Log: Fix bug #70179 ($this refcount issue)
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2d6f0e4584375c90a895fed4074d579f364aa347
Log: Fix bug #70179 ($this refcount issue)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC