Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98552 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87558 invoked from network); 15 Mar 2017 22:51:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2017 22:51:12 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.86 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.86 mx105.easyname.com Received: from [77.244.243.86] ([77.244.243.86:60967] helo=mx105.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/94-38004-F55C9C85 for ; Wed, 15 Mar 2017 17:51:11 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1coHl7-0002X9-Rg; Wed, 15 Mar 2017 22:51:11 +0000 Reply-To: internals@lists.php.net References: To: Marco Pivetta , Ryan Pallas Cc: PHP Internals List , =?UTF-8?Q?Beno=c3=aet_Burnichon?= , Kalle Sommer Nielsen Message-ID: Date: Wed, 15 Mar 2017 23:50:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES X-DNSBL-SURBL: YES Subject: Re: [PHP-DEV] Add __toArray() method to objects that would be called on cast to array From: php@fleshgrinder.com (Fleshgrinder) On 3/15/2017 11:40 PM, Marco Pivetta wrote: > Which is precisely the BC break: such a library would now throw an > exception "unsupported class X" when `__toString` is implemented. Also, > such a library would break silently when this feature is implemented. > > Much like the already very broken `__debugInfo()`, this automatic type-cast > is a giga-Joule footgun. I have to backup Ocramius here. As I already wrote, let's go for a totally normal implementation without any kind of magic. This is the only way to be safe, and the only way without adding more weirdness. All this special casing and magic only creates problems in short and long term. -- Richard "Fleshgrinder" Fussenegger