Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87145 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30894 invoked from network); 13 Jul 2015 14:19:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2015 14:19:46 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.45 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.218.45 mail-oi0-f45.google.com Received: from [209.85.218.45] ([209.85.218.45:33331] helo=mail-oi0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B2/29-43998-009C3A55 for ; Mon, 13 Jul 2015 10:19:44 -0400 Received: by oiyy130 with SMTP id y130so254695240oiy.0 for ; Mon, 13 Jul 2015 07:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=d4MR3kmC/5RnrqJNMSnIU09ExX/tyaW0lAP8U58pRkA=; b=f6SPssy6e2dPy5swZPXO/qmbnNT5OvAi32f2KqD8pEAOfMvhbMw18Vrfsrl+MyIsfo pSArLtvr9s1vMpQSbu+nrRLa6deYqfYKFns+QFrq9sOc9lykhbgGhOdtavrX6fLMILY+ Xw3eXUpv2ka+SVEQGWzllaTqh3Xzd+KxgM6TdrD0OvDrAC0rRpE4+PFjL0Ql0nAqqkZz M0Ty5EoPiPwxuVO18+6lMqMGK46mZsYAQ0N2roL7yGr9X6shN2CuYF7X4Lzmrk72EtVv Yu0/BtDf3u16euLoZg0g1pTLyhTjmR41VixebEemtm6bzEk0Em5eCwE7Ckm4dd2rgYTc ibiA== X-Received: by 10.202.61.85 with SMTP id k82mr3387262oia.73.1436797181694; Mon, 13 Jul 2015 07:19:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.211.67 with HTTP; Mon, 13 Jul 2015 07:19:22 -0700 (PDT) In-Reply-To: <59f8fa10-10d2-4498-91a8-bacc3fcab4ed@me.com> References: <59f8fa10-10d2-4498-91a8-bacc3fcab4ed@me.com> Date: Mon, 13 Jul 2015 10:19:22 -0400 Message-ID: To: Dean Eigenmann Cc: "Sebastian B.-Hagensen" , PHP internals Content-Type: multipart/alternative; boundary=001a113cd1c0a11c6c051ac26910 Subject: Re: [PHP-DEV] JsonSerializable New Interface method Proposal From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a113cd1c0a11c6c051ac26910 Content-Type: text/plain; charset=UTF-8 What about JsonDeserializable? I would like to have the choice to have a serialize-only operation. On Mon, Jul 13, 2015 at 10:13 AM, Dean Eigenmann wrote: > The Additional function you have proposed seems like the easiest and best > way to do it currently without changing the language. I was thinking of > giving the cast syntax special meaning if used in connection with > json_decode, but this would most likely be near to impossible. > > On Jul 13, 2015, at 04:08 PM, "Sebastian B.-Hagensen" < > sbj.ml.read@gmail.com> wrote: > > 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. > > -- Guilherme Blanco MSN: guilhermeblanco@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada --001a113cd1c0a11c6c051ac26910--