Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116013 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36868 invoked from network); 8 Sep 2021 15:55:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Sep 2021 15:55:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CF12B1804AA for ; Wed, 8 Sep 2021 09:33:10 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 8 Sep 2021 09:33:10 -0700 (PDT) Received: by mail-io1-f43.google.com with SMTP id z1so4050002ioh.7 for ; Wed, 08 Sep 2021 09:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZWj972Qrb81FdeJ9E7z4XX4Hn+/GZRucaEyqlxDcM8g=; b=lq+dFJnebYrQwTp3z0wWazrLEzX0hPLgkn348+rXiRV9Jvc9YznTLNA3TaGAHNC4AX 6XVaEE6796jwfms8YuP1E4zfGQ4hLnyyFQv2MwgLjX9MSw9LLfl0+iA+vMRme50STyUS E6OY1zar3X+dAYqTu37tR+IoHAWeLqQ8SHrX4vWqmrU/RTYvOvL2nNIOzNz7CXQkbzzI byQP9hCdA3H3DmLwUe5G/6/F5oF/vpmmXeOf1kcSQad076we1R994iDSpfDNMeFZE9L5 wrcAYu9atArZEI8JhkU9uuSweq9O8X5g+KSn0OxiTGPZoIpUMisCAggtnXMTEJrZzWws TmQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZWj972Qrb81FdeJ9E7z4XX4Hn+/GZRucaEyqlxDcM8g=; b=bMDoXzfYGSapCNhfBeKtOK5B6pgjUuibI2ysavIVmc332tbFtUptd3Ac4GRBL68oKM ZYW16488LbIInvT8L5dflGjaj8aqvpRg6V8qMULYNBvFVqkkKWTjyidPiHIujhYwyumb JVOT6q+ap9LSG9G19r3Zn02SFlX/A9VeMVrGUCCpg8EdFfMILgfFUz4ZtAdFcYXzIL6O RuOFt8zZZAnnvKZviOsSSslUBxwmrY9qAgpA1PRHFAh/sPWl64oEWnVQV42zgihhULNM Ne6o4BRQWbYnFw/6oIAMSgXvAxZ1hsTmEnRP8UJLaeOEyqDPjjHDG4LogSWkimWrRF2q 64HA== X-Gm-Message-State: AOAM533zFXfosVzixs2rJpaNwsjXA0clIpMfZJTa0d9jPQSaf11nu2bl XRRqIDIQffR5wFmjPSeqUyW93zCtjB29EmOBNrc= X-Google-Smtp-Source: ABdhPJx0jOwF2/ZdpX55Jp4D7k433u/DeOx3tefpC6b32RRsh7zXBwT7PHcUbr2ryvqm+/wSMUh5jT7STPp9DPOJhe4= X-Received: by 2002:a5e:db06:: with SMTP id q6mr659873iop.24.1631118788634; Wed, 08 Sep 2021 09:33:08 -0700 (PDT) MIME-Version: 1.0 References: <46f2e842-8608-0622-f1c1-3eb746658c84@gmail.com> In-Reply-To: Date: Wed, 8 Sep 2021 18:32:43 +0200 Message-ID: To: Mike Schinkel Cc: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000fbaf1f05cb7e6f5b" Subject: Re: [PHP-DEV] Alias stdClass to DynamicObject? From: kjarli@gmail.com (Lynn) --000000000000fbaf1f05cb7e6f5b Content-Type: text/plain; charset="UTF-8" On Wed, Sep 8, 2021 at 5:38 PM Mike Schinkel wrote: > A couple more things; add a `JSON_OUTPUT_DYNAMIC_OBJECT` flag to output to > DynamicObject for `json_decode()`, add a 3rd parameter for flags to > var_export() for the same reason, a `'return_dynamic_object'` option for > `unserialize()`, and so on. > It would also be interesting to enter a user-defined class here to work as a reversed JsonSerializable. Could be a static factory method for all I care, and would omit the requirement of serialization libraries for "simple" things where you still want decent object typing. Could also work together with interfaces accepting properties, effectively making the result of json_decode an anonymous class that still adheres to an interface. In case of the custom 'deserialization' you can throw exceptions if the format is not correct. In the case of an anonymous class with an interface it could throw an exception if the structure doesn't match (possibly controlled by flags?). --000000000000fbaf1f05cb7e6f5b--