Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98550 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84389 invoked from network); 15 Mar 2017 22:36:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2017 22:36:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-ot0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:33048] helo=mail-ot0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/E3-38004-AE1C9C85 for ; Wed, 15 Mar 2017 17:36:27 -0500 Received: by mail-ot0-f172.google.com with SMTP id 19so36182366oti.0 for ; Wed, 15 Mar 2017 15:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kWr9/BvD4OmriQPqEiDvgsDjF02GfKLComBS9icqr0o=; b=NeVzazEuAW8ncIly1DiPaJCC4ghsGzlOr9eLdU9jMSVupyVjyvX9iuqtT21gF7NOBk 3uRIkbDKLxj6YavGTWgbYeKxZ0v57UpJqAHSF74qmr0z/SLVHIcsC51N2Um58ZPlp9jm 3jYKlKzzmeniJlkK4EfTmgPhSwtaE9dgW/u/kjYcjKlWAMaP9StdsBybGfglD9izbDQv 5Ds9dG6VBQXmKryzgBPXuR4+h/G/v9h0aEH2MyBauZfRSMWbadrlp0bC2qwtfFeDKn6R K7qgnJm0QkqEPawadPLebXJtazt9acri3jdtYF34WVeRhKan5xWROXZI77orQm254sy5 MKVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kWr9/BvD4OmriQPqEiDvgsDjF02GfKLComBS9icqr0o=; b=FBHJ9SLF89R09x3NBpRTxtobk8XRV3l6zfBzEclf7xO2ce9yOtIQbEfLaqeh44qkMk GLkENl0gnGdW8oJTz/STRNEwLm6HVnK70ZdxFa/S6dcLi3kqeCm5ZJ+0Mpirfdm1ey8A 8rTCXG0a0ejHxu/avJktTuOzaRaqsl4jOU+7qtFXkgewYeovzVo+f4R/GwVDztQCll8s mBjyrkdmxhE5gLoDLBYsizFdoo0bcNRg0jQcdw2VcAVJgRjee3DT0qI9d0prjejRNvDG uXeVd7EBocSHu9ZOZPCCNERmpYecjO/2HoTAP/lzIfe93C8Yh0NcSm6+s2sYbQ0iLQ9h VJIw== X-Gm-Message-State: AFeK/H0Kk0Yd7Mu5WcuqCLaJoZ5Ah8dQG1i7vsSHnEq1ZI7On6h7GMAXQVQKp+kzz0ssok8ZRiOSukUdGAVXiw== X-Received: by 10.157.37.106 with SMTP id j39mr3230977otd.173.1489617384357; Wed, 15 Mar 2017 15:36:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.11.227 with HTTP; Wed, 15 Mar 2017 15:36:24 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Mar 2017 16:36:24 -0600 Message-ID: To: Marco Pivetta Cc: Kalle Sommer Nielsen , PHP Internals List , =?UTF-8?Q?Beno=C3=AEt_Burnichon?= Content-Type: multipart/alternative; boundary=001a1141ad060bc7c1054acc9398 Subject: Re: [PHP-DEV] Add __toArray() method to objects that would be called on cast to array From: derokorian@gmail.com (Ryan Pallas) --001a1141ad060bc7c1054acc9398 Content-Type: text/plain; charset=UTF-8 On Wed, Mar 15, 2017 at 4:33 PM, Marco Pivetta wrote: > It's the only way to distinguish between set and unset properties. Also the > only way to get all properties from an instance of an inheritance tree. > Also, it's covered by tests that were explicitly added to prevent > regressions on this. > > Same as all similar discussions before this one: need an alternative way to > do things before proposing a BC break. > > As mentioned in previous mails - the intent isn't to change existing behaviour, but to provide a way for a class to override the default behaviour. As long as those classes you are casting to array don't implement __toArray they will behave exactly as they always have. The only concern then, is that you might be relying on a library to not implement that function on a class you are casting. > On 15 Mar 2017 11:27 p.m., "Kalle Sommer Nielsen" wrote: > > > Hi > > > > 2017-03-15 21:41 GMT+01:00 Marco Pivetta : > > > This is a BC break due to the fact that the `(array)` cast is used to > > > extract property information from private properties in library code. > > > > Yep, but then again that is more of an > > undocumented-not-really-supported case afair, if anything then > > Reflection should have the APIs to officially allow that, although I > > am still skeptic of this. > > > > > > -- > > regards, > > > > Kalle Sommer Nielsen > > kalle@php.net > > > --001a1141ad060bc7c1054acc9398--