Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108375 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91399 invoked from network); 4 Feb 2020 15:21:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Feb 2020 15:21:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A42AD18050A for ; Tue, 4 Feb 2020 05:33:19 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE 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-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 ; Tue, 4 Feb 2020 05:33:18 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id t14so3663269wmi.5 for ; Tue, 04 Feb 2020 05:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xxUbg5s014KbSGwNdyPwtyuzkWAnqYWvQgWgikhHlB8=; b=RFLQegE+8rXgcN+QbdyqvuqNkwUi4/Zi/UuN7KF49lcIUgzTyQreiNy1yBtg4M4QSN BkPp88MVybw3qNf0hYDfmD0o9PMtKt3gy/W+D8T9U1jNCWdixdv7B2oAPAlmZoC04TW8 45Ktr1/sxRS7DSQPSCNDMTcR9xWM1oFrQAl9y63cwY1d4mf6ayqIyAOGJq4m1b1Zlnjb QqGEUc5+DEW1MV90mP1j34pEcI5yWixBn7Au6NxpOxJ7GK12nAviM4jgTxA8/uU3V/89 EUY7wQWCy9Q5mI2V5g3RW7rnvixsddaMNd4MFLg+VpQy3lHS4gAYqlKJHfjVWSe757UH Y6hQ== 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=xxUbg5s014KbSGwNdyPwtyuzkWAnqYWvQgWgikhHlB8=; b=rUXFAYc4kgdFB8dVjaahQO45hj3+uGSu21RCpowvtkvKViWRTJdZaazgpl9eqQHZBW OTk+WgfT/OdRt0BYsww7Ps7bh4/wY8bytTDRiD9R3bybFd1Qavhq8XpyRe5QyOchrBEx PvkyMr/CY/RyUI/1LPNF4Wsn6mGUFbN+yPhio1apwSzayp8dljD6aDsLoDOLzyCBgxUl QSMlQ5hGY2/6mpKZzRhvnMzfE3neUt5r/xf4lhBMP8NsbXMfHHRmLUA7gKHVJySDaU00 2mlaZm/e/JTBF5V2gXESxMSpHG/GME0VvjzDc2V5NGUfD08HlU+U71tcz08jXpLo+sH9 M8pg== X-Gm-Message-State: APjAAAVRj7bmfBLf5TuWdVmR9bb56JPy1LQse8v1ucy2laotpIy/auc/ Rj88C+5jtAfJRdNhdKAkInyxrrdTJQtEqtGD771T3OMCpho= X-Google-Smtp-Source: APXvYqz66i+mTeL3R4ntOJoUMbJeA4VYIXmRVeVnPg/y3zWvbhawKrDXO0lFDVYsGFaT5sQNqv5mXKyj2R2tdj0IGBg= X-Received: by 2002:a1c:20d6:: with SMTP id g205mr6138557wmg.38.1580823197396; Tue, 04 Feb 2020 05:33:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 4 Feb 2020 14:33:06 +0100 Message-ID: To: Steven Wade Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002242bd059dc01545" Subject: Re: [PHP-DEV] [RFC - discussion] __toArray() From: kontakt@beberlei.de (Benjamin Eberlei) --0000000000002242bd059dc01545 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 4, 2020 at 2:03 PM Steven Wade wrote: > Hi all, > > I=E2=80=99d like to officially open my __toArray() RFC < > https://wiki.php.net/rfc/to-array> up to discussion. I=E2=80=99ve delayed > changing the status until I had more time to respond to the discussion, b= ut > since it=E2=80=99s been brought up again , I > figured now is the best time. > > https://wiki.php.net/rfc/to-array > I am open to the idea of having __toArray. I just have a few questions about the RFC details. 1. print_r($object) would somehow call __toArray you say. Why would it cause a cast when nothing else is cast? I would prefer print_r((array) $person); 2. In the parameter and return type examples you should add declare(strict_types=3D0); so it's clear this only works in weak mode. 3. The weak point of this proposal is the by reference handling for sort et al. Counterpoint: if you pass a variable to preg_match, then matches gets converted from anything to array, so i believe by reference casting should change the original value (https://3v4l.org/XUJ5m). This is weird, but consistent. Cheers, > > Steven Wade --0000000000002242bd059dc01545--