Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98543 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67666 invoked from network); 15 Mar 2017 19:29:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2017 19:29:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=bburnichon@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bburnichon@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.172 as permitted sender) X-PHP-List-Original-Sender: bburnichon@gmail.com X-Host-Fingerprint: 209.85.128.172 mail-wr0-f172.google.com Received: from [209.85.128.172] ([209.85.128.172:36555] helo=mail-wr0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/51-38004-E1699C85 for ; Wed, 15 Mar 2017 14:29:35 -0500 Received: by mail-wr0-f172.google.com with SMTP id u108so17854311wrb.3 for ; Wed, 15 Mar 2017 12:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c3BLJ6jszsopSrlvVoN6/IgWqUlw6UhcLL+Ifvx69dQ=; b=jKY+3U7B0l0F1OCrbNbnL000Cxws2Qdx714IEU8acbcOF6Y9XM8HFcP3BIypV2/jbL 5J7bwoXkq8rvwBaOPgDm5b12kEVygjc8WqI4QGnZFCp0gjqHQAN7Hk33gr64C/TSmoU4 AJVysP/PFTXOg9fQ1eWeWAM/TJqruQP101CcZfCoN7fhHq9WC+GBYa/FM7K7GD4q237c xh58Qiicmgx+7lFZllPVgG/UWJPz7zYpxP3Se4HpGmEyAXc64sWbdXwdvRchzq29HGpf y1LOBzBzVyr8MI+wEifWp3ZIvBTQ/HJ36ph+F5aozFG6MqwAw5/83B+aHI/ISEIBrIXv Fy6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c3BLJ6jszsopSrlvVoN6/IgWqUlw6UhcLL+Ifvx69dQ=; b=iGa5WrtG9CbBjTtkH3McfDi4LIdnEPZNm0hXcFt57A8KM4rnMOpIPL2biXZmAwJAOU Fo20rJl88bdDyJ7a/+MkbocDlKMPez5MB7QgrvUzvl33E1TJFSrJO5cR79uThLYEziPT xPwi0KXEFADy8iakHS2x8m1Z3aLLO8ymxjkufDz1exJntoNgkH7fwsxDn0Sh5++bHj0Z lHQNYal/fKlDanysOsLcQWCQnXXpIps5yl9MYRyrafmrPu6TZuC9XSFJRfFHJGTk3UbS IWVTPGIwWzivqd2/g+2c/h381ksE9sVn5ZQdkfdM7oYcs50/kauwtgbDfi26hNiWsf3l /XSw== X-Gm-Message-State: AFeK/H2+8nOi2Iv34jKu7JZWVjSbHfR1j3kqPgkpK12ZUb/BX+P2EjZ7S4x7NyQZZKpstL3qIyIitpEstE7wDw== X-Received: by 10.223.134.69 with SMTP id 5mr4889181wrw.22.1489606172107; Wed, 15 Mar 2017 12:29:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 15 Mar 2017 19:29:21 +0000 Message-ID: To: Andrey Andreev Cc: Ryan Pallas , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11492440be6d56054ac9f620 Subject: Re: [PHP-DEV] Add __toArray() method to objects that would be called on cast to array From: bburnichon@gmail.com (=?UTF-8?Q?Beno=C3=AEt_Burnichon?=) --001a11492440be6d56054ac9f620 Content-Type: text/plain; charset=UTF-8 > > > Same restrictions could be applied to this magic method: > > > http://us3.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring > > > > By this, I mean, no exceptions should be thrown in this method and return > > value MUST be an array. > > Exceptions cannot be thrown from inside __toString() because that's > hard to implement; it's not a "feature" that anybody wanted. > That is why I said 'could be applied'. I don't currently know whether this will be hard to implement. Maybe these restrictions are unneeded but I prefer to be stricter than necessary as it generally make it easier to implement. But thanks for the clarification. --001a11492440be6d56054ac9f620--