Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87143 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26464 invoked from network); 13 Jul 2015 14:08:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2015 14:08:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=sbj.ml.read@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=sbj.ml.read@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.182 as permitted sender) X-PHP-List-Original-Sender: sbj.ml.read@gmail.com X-Host-Fingerprint: 209.85.213.182 mail-ig0-f182.google.com Received: from [209.85.213.182] ([209.85.213.182:33397] helo=mail-ig0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/38-43998-346C3A55 for ; Mon, 13 Jul 2015 10:08:05 -0400 Received: by iggp10 with SMTP id p10so76341757igg.0 for ; Mon, 13 Jul 2015 07:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=COp+/UWHrK7gMES1L+iruaHUOPxRbl+t3W3NhLEr/G8=; b=Xf11XgGjG2CZ//obWuM94HOQafaR2c0Am4HWBvWswJgx3VaridTrUBMfbPxQhMIawy ejI05CVqmAI8/dOHfsdladw5EZLv/2iZL5iixyAmvuKqZ2qwxxYRz7Cvw23t57FObSD6 tw0Zig+7ijqrLUT18GyKU6SwiBFD0cfG4XZXlG/YzRGEuFAUbIeE5sOf6l065VXUpHK3 ziQdC3k7Fd2uz3GvtGDJA1f6yRWHUDWOJXq6/1sJ1qMObJSDBLZuJAyd91onpZmb2snN wChxAlvg94fTHxgzUI6fIBNV9bIiHLLXWWtL/oQQoZQE2VXwLm+lLLmkCocCME3BrQqv NKrA== MIME-Version: 1.0 X-Received: by 10.50.143.37 with SMTP id sb5mr13154971igb.13.1436796481248; Mon, 13 Jul 2015 07:08:01 -0700 (PDT) Received: by 10.107.181.194 with HTTP; Mon, 13 Jul 2015 07:08:01 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Jul 2015 16:08:01 +0200 Message-ID: To: Dean Eigenmann Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] JsonSerializable New Interface method Proposal From: sbj.ml.read@gmail.com ("Sebastian B.-Hagensen") Hi, I like the general idea behind that proposal. I'm not sure how you would want to implement that however (please expand the rfc on that topic). Do you want to give the cast syntax a special meaning if used in connection with json_decode or add the general ability to cast a stdClass object (as returned by json_decode) to a specific user type or do you want to change json_decode to return a new class (extending stdclass) that can be casted in the way you want? The first two could be considered fundamental changes to the language, the third may include serious bc concerns. Wouldn't an additional function (maybe in addition to your proposed interface; example: json_decode_to(string $json, string $className, int $options)) solve the issue without changing the language? Regards, 2015-07-13 15:22 GMT+02:00 Dean Eigenmann : > Ive just opened a new RFC https://wiki.php.net/rfc/jsonserializable > regarding Json to Object unserialization.