Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97766 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43609 invoked from network); 15 Jan 2017 23:20:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2017 23:20:14 -0000 Authentication-Results: pb1.pair.com header.from=netmo.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=netmo.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.49 as permitted sender) X-PHP-List-Original-Sender: netmo.php@gmail.com X-Host-Fingerprint: 209.85.215.49 mail-lf0-f49.google.com Received: from [209.85.215.49] ([209.85.215.49:33883] helo=mail-lf0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/10-00729-AA30C785 for ; Sun, 15 Jan 2017 18:20:13 -0500 Received: by mail-lf0-f49.google.com with SMTP id v186so70522598lfa.1 for ; Sun, 15 Jan 2017 15:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=rMTPfj2OIs4wmsaY8SNB3rolu/osaE1CAboM6srj0ow=; b=C6q+cs+baNth64ofjhXbENrNIMYIOGIvKFtbG5uVQpljsYZwkWXPjTJGVZUTFJab7L eKMF1nB+2c+MSte060WuZ/W053Ke1jh6HvpWY8LBumZo+ZA/I7v4MEhSOXxBS/D9DiWU SThZNRWGxt3eouG5rju5VCn1Sb7LKZZ7bLMzfdZSazv+mAsh06rwvVoTkz7aJypPulu2 CP31kL39t3yCfdrmPhUqlI8S/fMkRnxxQQcyyto+VqoZN2HqORhTaas24/0b89mQb5B4 luxsn3vTgWjs6y1cH4j6B9RyZbLoDQSxRGJyFXKUy3VlPXtNBadaQ0ZO4lVnmQJw9MAH YEOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rMTPfj2OIs4wmsaY8SNB3rolu/osaE1CAboM6srj0ow=; b=GGs2STYJDAx7E0EsUR2LRcs5HVkgvMEPr2WyNzhH/+gXxigto0GvEK984WOpsjuCXd 0GQkx1XuJNXt9eywbVnkVcaAyOfor27cn7z2SJqGM4ALt1Q7Tnri3KLU87xOLmbZAFg0 H4ILgtBXOS0V0T6uPEdRsphk0EhfggNgHzW/LCHTJjADwyaPoWiJh7zoyFTlygq8BJCz bIvEmqe+/Uj+L5ZH9lz8l78v+q5ja8pxisURcZ4JR8SIF7OKHQUvhd0SunDYnweukjUD 6YL6pIB4TL98tzzB2rb5ExqF4iurlKP4GWv/g8fn5SlSWam0oxUf78CkzumkOacFbdFK pDLw== X-Gm-Message-State: AIkVDXL5HB79npkKa14P0P7WHvRpJmaiV3uhDquZlHr1eq5cJrPno26yG0OGLJAs5nXOsXXwIYGwfPTcTiTC4g== X-Received: by 10.25.193.3 with SMTP id r3mr10921262lff.54.1484522407296; Sun, 15 Jan 2017 15:20:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.75.12 with HTTP; Sun, 15 Jan 2017 15:20:06 -0800 (PST) Date: Mon, 16 Jan 2017 00:20:06 +0100 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=94eb2c1a1710bf820005462a4e05 Subject: [PHP-DEV] Unsetting declared fields From: netmo.php@gmail.com (Wes) --94eb2c1a1710bf820005462a4e05 Content-Type: text/plain; charset=UTF-8 Hello elephpants. Currently PHP allows explicitly declared fields (eg public $foo = 10;) to be removed entirely through unset (eg unset($obj->foo)). Now that isn't really an issue as properties in php are currently untyped and therefore nullable; at worst you would get a notice. But it would become an issue with typed fields... that might get a second chance sooner or later. But regardless of that, it looks very strange to me that this is allowed for fields that are explicitly declared. I think unset() should set the field to null if it's declared in the class, and remove the field altogether only if it was defined dynamically. On the other hand, this is just one of many ways of hacking php that just exist and we accept / don't care because we have faith in other people not doing nasty stuff with our code. This might sound ironic it is actually not :P However, I am curious: what you think about this? Should PHP do something in regard? Should this continue to work like it does now? Why do you feel it should do the one or the other? --94eb2c1a1710bf820005462a4e05--