Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:104627
Return-Path: <rowan.collins@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 75750 invoked from network); 10 Mar 2019 22:46:51 -0000
Received: from unknown (HELO mail-wm1-f47.google.com) (209.85.128.47)
  by pb1.pair.com with SMTP; 10 Mar 2019 22:46:51 -0000
Received: by mail-wm1-f47.google.com with SMTP id z84so2291613wmg.4
        for <internals@lists.php.net>; Sun, 10 Mar 2019 12:36:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-transfer-encoding:content-language;
        bh=tY28PEzteVFAqcfaUKb6/6eNNPRjdBWC9EQGLrbJWVY=;
        b=svZiM5mku2iAOv2ftOulllLHVkvFun6iz1WHuOv3xhVH3DAGkVYT+gQ/vMPzFXNESm
         jOMW/7RaxmxEU3xV98hDTz5WTZYMcnXp4U99b6PoQwM5TX3vMqyW+/TbOx7pygJrHn8j
         ZZk7XzIydeIvEm8iXdEvEGvOn2bLUR3Nbcykng6ao9QKrM6r+Q8tM03WFRajLyst2LZJ
         F7fA6Q9LUP3ik0+n5+ePmFl87DyePvmigiy/WtqO7G9vOmwsIOsghfoaFH7R8SuwxLqe
         0Ro1ke7jIPUzrKXNaSYKCQuvTJbEp93TZWVmnBezMPq7/nwVn7U0oDyPyaIdmDRNHG7b
         o/aQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=tY28PEzteVFAqcfaUKb6/6eNNPRjdBWC9EQGLrbJWVY=;
        b=sN5PD6F3AGc5tdT2EmtPSfSZWTswj6O03WfcUTLWsTavNy9/VJdDCcHBxcrrnyCuYF
         t1lnsK9E6d9xp+KP6tXBqSh9gkvFvPhDoIQt+RVSOf3HAGQ0wY8WZuVYHRQN+ZPxyUly
         6szInfOQiSUrJaUYUwBUrgIy0V444J9ux65lDuAqe4NtvscTMrBKEyLUu0RbAuBtNd5Y
         1fDtG3SZnw/I+4P/MS4B4MUZbcENhUxvNNjXPSwR+gzQASIMkRUwnsH2TZO3Ef8oezM4
         6Tp6vLDvZhI/lV0kvQwT8iU4Rbo9QKGMK5FKtXFcL5NJEGuxbWMdJ68eSLDjhHdcrlDb
         DkmQ==
X-Gm-Message-State: APjAAAWS7yY4mDYZ2iDZ1/6MgmQ9h428iO+q1hMuMjqE9AD7EmnDydau
	mxIKquFjZyYQ3dK7IQSErmLnH+3y
X-Google-Smtp-Source: APXvYqxa9ByyCwaWGI0dAbLzsuwIArzpDqUeA56WyIuLym0pIjTlXG1p9YDla4U6cmVwGqzgIbzNuQ==
X-Received: by 2002:a1c:eb14:: with SMTP id j20mr15877336wmh.32.1552246577876;
        Sun, 10 Mar 2019 12:36:17 -0700 (PDT)
Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115])
        by smtp.googlemail.com with ESMTPSA id u13sm28906744wmf.3.2019.03.10.12.36.17
        for <internals@lists.php.net>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 10 Mar 2019 12:36:17 -0700 (PDT)
To: PHP Internals <internals@lists.php.net>
References: <2c497732-96f8-3ef0-bc18-912220fbff4d@gmail.com>
 <EF8808F3-262F-4EF6-9E57-7B6BF1898589@gmail.com>
Message-ID: <04de234d-a583-f53d-572a-e55f0e092c89@gmail.com>
Date: Sun, 10 Mar 2019 19:36:16 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.5.3
MIME-Version: 1.0
In-Reply-To: <EF8808F3-262F-4EF6-9E57-7B6BF1898589@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
Subject: Re: [PHP-DEV] RFC: Locked Classes
From: rowan.collins@gmail.com (Rowan Collins)

On 10/03/2019 18:56, Gabriel O wrote:
> Isn’t unset() currently only way to remove reference? This part is hence very problematic.


Hm, that's an interesting case to consider, thanks!

At the moment, the following code breaks the reference between $a->foo 
and $bar, but also deletes the entire property from the instance:

class A { public $foo; }
$a = new A;
$a->foo =& $bar;
unset($a->foo);
var_dump($a->foo); # Notice: Undefined property: A::$foo

This feels very peculiar to me: $foo clearly *is* a defined property, 
and I didn't want to over-ride the class definition, I just wanted to 
"reset" that property. We can chalk it up to "references are bad", but 
it is indeed problematic that there isn't an alternative way to say 
"breakReference($a->foo);" that doesn't have this side effect.

Regards,

-- 
Rowan Collins
[IMSoP]