php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68191 Broken reference across objects
Submitted: 2014-10-08 21:29 UTC Modified: -
From: miloslav dot hula at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2014-10-08 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: miloslav dot hula at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-08 21:29 UTC] miloslav dot hula at gmail dot com
Description:
------------
I'm trying code on PHP commit 51c90e999fabda0cc10b82e0617e6e45797bf81d. With the latest I get SIGSEGV.

Following code works with PHP 5.0.0 - 5.6.1 (http://3v4l.org/Lc1QW). Workaround in method Bar::modify():

$this->prop = $this->prop . 'xxx';

Test script:
---------------
class Foo
{
    private $var;

    public function buggy()
    {
        $bar = new Bar;
        $bar->prop = & $this->var;
        $bar->modify();

        var_dump($this->var);
    }
}

class Bar
{
    public $prop;

    public function modify()
    {
        $this->prop .= 'xxx';
    }
}

$o = new Foo;
$o->buggy();


Expected result:
----------------
string(3) "xxx"

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-09 10:06 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e919caca86d78a25d4de10d2df2e1c4357ac4408
Log: Fix bug #68191: Broken reference across objects
 [2014-10-09 10:06 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2014-10-10 20:59 UTC] ab@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e919caca86d78a25d4de10d2df2e1c4357ac4408
Log: Fix bug #68191: Broken reference across objects
 [2016-07-20 11:40 UTC] davey@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e919caca86d78a25d4de10d2df2e1c4357ac4408
Log: Fix bug #68191: Broken reference across objects
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 21:01:24 2021 UTC