Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105621 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84742 invoked from network); 7 May 2019 15:53:57 -0000 Received: from unknown (HELO mail-yw1-f50.google.com) (209.85.161.50) by pb1.pair.com with SMTP; 7 May 2019 15:53:57 -0000 Received: by mail-yw1-f50.google.com with SMTP id b74so12993469ywe.5 for ; Tue, 07 May 2019 05:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SVJoKdanjOAm6COxNuSNhqc32AfKqqcq5WstXErG3Zg=; b=tJswhtNnADYgmv31+MTpG1bvXlWidZ/rfgk9+ePSoi2VRV2ZpvlQFdHWuJhkGAx6Bb twte57voBLK3P6XjSLM314hajaRlMKP1HeUNNcHvQLFy0Qb0/s8XfgQYmZOUquDNb0Hz EkMV/wjsV/z9Y1uhP1+TrNxp1ljJui5tQjTdqo2YwkRKWFqFeshajOm0+7gP9UsX7u9C DGPz/HcX+tXnwVPiNGHc/WAUJpja5ZVK548cQkIrf2i9QjmEZWMJgR2CP/u93FnHXBf1 UBnbzB4kdyuINlrINWhczEMZCzUrwY0jjsROgC00/k5sLBP/HiGGGMfjr1pQzQmtIojC 5UEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SVJoKdanjOAm6COxNuSNhqc32AfKqqcq5WstXErG3Zg=; b=EWD6aCq4Wya+bO/SExQ4Sos44orHSl7LPyyCvG+qRoIOpK85UGWMcepZW/CgPm77E8 hZwLDEUF08Seeposwm1Zp/a5MJJMVZvFw0O1LQD3yqf96Ga/64Ab+sQF8bjQ0wpMMegs wdT7NKUR7cvmWD32wSRb1cgk98KnKUPj8ekH1WomMu8lZMSwA0AXuWFGJh46nuFrGsJ0 3pmqmVHEi7tob/E/O6oQ6mDY0HQUMooQGfnFwiWqOJLGWx20ni5svBN/HD20U2Kj/tVx MbyH0Rdekko1MhAn4aDAYlAzDNIrxpWw1R2o+lfENx9l2T/oAOZXbZQ8ZKP7sgAi/XtB W+gw== X-Gm-Message-State: APjAAAUy8DW+ApxOMbV+kbD4njY+D+sgiGNXZ8R5f3lwz8rWcCBouK+z oOaSVGmwq98zdCayfH3LKz4= X-Google-Smtp-Source: APXvYqxhhSklofLCzKuLzq3fiP2ccW/hcmWUaR3lRK4Tvo844751Mwma9dfKM3hg1pWi1ewAwfRVwA== X-Received: by 2002:a81:9857:: with SMTP id p84mr1375280ywg.392.1557233870900; Tue, 07 May 2019 05:57:50 -0700 (PDT) Received: from [192.168.86.89] (99-63-227-78.lightspeed.gnvlsc.sbcglobal.net. [99.63.227.78]) by smtp.gmail.com with ESMTPSA id p3sm3953576ywf.2.2019.05.07.05.57.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 05:57:50 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) In-Reply-To: Date: Tue, 7 May 2019 08:57:49 -0400 Cc: Nikita Popov , Nicolas Grekas , Marco Pivetta , PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: References: <76C69198-A778-4B60-8EBF-8BDEC7D2DBC1@koalephant.com> To: Stephen Reay X-Mailer: Apple Mail (2.3445.104.8) Subject: Re: [PHP-DEV] Proposal for a RFC From: stevenwadejr@gmail.com (Steven Wade) > On May 7, 2019, at 8:52 AM, Stephen Reay = wrote: >=20 >=20 >> On 7 May 2019, at 19:47, Steven Wade wrote: >>=20 >>> Maybe I=E2=80=99m missing the point (I=E2=80=99ve never used it) of = VarDumper, but isn=E2=80=99t this type of thing exactly why the = `__debugInfo` magic method exists? >>=20 >>=20 >> I can't speak for the exact reason a library like VarDumper is using = casting versus __debugInfo, but in trying to find a substitute this = morning, I played with the method you mentioned and found that it can be = overwritten by classes and be commanded to not return anything (similar = to my __toArray proposal), whereas current functionality prevents = overriding casting to an array so casting will always give you insight = but users can overwrite __debugInfo and cause unintended effects. I = assume that's the reason for not using __debugInfo. >>=20 >> -- >> Steven Wade >> stevenwadejr@gmail.com >>=20 >>=20 >>=20 >=20 > Right, I understand that it *can* be overridden, but surely if = someone=E2=80=99s doing that, its because they want more useful = information provided in, e.g. var_dump. I think that's a good point. If we follow that mentality, then the = proposed __toArray and it's subsequent ability to affect array casting = isn't a worry too much as the proposal is to only call __toArray if it = exists and an object is cast to an array, so if a user manually = implements __toArray, then we could assume "they want more useful = information provided in, e.g. var_dump." -- Steven Wade stevenwadejr@gmail.com