Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113318 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81227 invoked from network); 27 Feb 2021 20:16:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2021 20:16:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A67B18050B for ; Sat, 27 Feb 2021 12:05:45 -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=-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-Virus: No X-Envelope-From: Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 ; Sat, 27 Feb 2021 12:05:45 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id n16so2198829lfb.4 for ; Sat, 27 Feb 2021 12:05:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VeiZRKc1ssgf7TtG2Xe1IAUnEJSte+XyfeJNcRwu1Wo=; b=VBfLwq7Zo0pPoNe+S0i4jfmT2UEHuTME1lM/uG5qiZzJK5hlrbcnkWUAC6j6pmwbP5 eOvBICYfQyYI2uNKsAAgD5aplUXzi/vagaOAeu/1vAHQRhCSNCOwnu5cvwKEsJanRpJT YmBCjRtYXBKbVHG5ZIUWlASbokcaN6jz37Avi0SLX9KxraBx8VMdQ5vJN6qAHmfx/S1P FonfeHhfiHbm2VqnIkmtjRA6tgGlQJCJzwD7/H96NRCWuYX7RPSkkKdXFgP5sH3VSneh n1qtcNkb4L3rb73lM7Nl6QivT1prhWwi4bY0alJGD0Gi3do1Dpy+uF6aRVnGr3jRdLO/ nniQ== 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=VeiZRKc1ssgf7TtG2Xe1IAUnEJSte+XyfeJNcRwu1Wo=; b=EMEX3cSTvOdwzHpSnYga9skPV0la3Jm7w+TvwQNeymgcKfepL00YdVg5GsqDIYLa9l RsrrqMguD6fnnCU1qvkWXauloS0Hfm+ymzy0u+QRgu7IbgSpu82laHsCG+JNt0sGJzcJ 8+TVbQVPBCa7QHfyi6oxVV6ufXfXNUvb3gnEptQ3StTrta+B6k4Yvql4RZUH/aDAgDKO Cn3gIl0Za2naEDX1EJU0YMXbHYwL+tqXvJv7Sscc5Qvxo9UTnM6kGsQpYgzNMHB2W4Gx LrSa1dzWdi6xDkhnxJEZYvouJkfAlpHseOY9qGgPbFAATEIyel5yGh0o33kCP+m8Cslt bmgQ== X-Gm-Message-State: AOAM533lTuK7H9n3kdCGpb17NZ9ChqvwtpGwE4V75zlalWf2K/DUUFsi KwPhr1xzgxGUmP3dlLcKuENKvrO8tBuhYCuhwQg= X-Google-Smtp-Source: ABdhPJzhWQXiREJjCKoqSbCDggZFEgm3UZ+cgsC3Fc0cC8yAacfJjNx84DtCOjS3FtS/hJSOg8ul3J5U8+zYJFvMMGQ= X-Received: by 2002:a05:6512:3090:: with SMTP id z16mr5423563lfd.44.1614456340394; Sat, 27 Feb 2021 12:05:40 -0800 (PST) MIME-Version: 1.0 References: <62243527-96EC-4234-AD50-EDB6333628D5@gmail.com> In-Reply-To: <62243527-96EC-4234-AD50-EDB6333628D5@gmail.com> Date: Sat, 27 Feb 2021 21:05:24 +0100 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000acb5f705bc56e8b3" Subject: Re: [PHP-DEV] Deprecate debug_zval_dump? From: nikita.ppv@gmail.com (Nikita Popov) --000000000000acb5f705bc56e8b3 Content-Type: text/plain; charset="UTF-8" On Sat, Feb 27, 2021 at 3:00 PM Rowan Tommins wrote: > Hi all, > > I would like to propose we formally deprecate the function debug_zval_dump > and remove it in PHP 9.0. > > This function is mostly similar to var_dump, with the additional ability > to output the refcount of a variable. This has always been hard to > interpret, but is now so complex as to be effectively useless: > > - Because it is implemented as a function taking a parameter in the normal > way, the refcount has been modified by the time it is displayed. Depending > on the value passed, this may include reference separation; in older > versions of PHP, it was possible to affect this directly by forcing a > pass-by-reference. The manual still discusses this, but it hasn't been > possible since PHP 5.4. [1] > - Since PHP 7, some types don't have a refcount at all, and references are > represented by additional levels of zval. Without completely changing the > output format, this information is impossible to convey accurately. > - Optimisations affect the refcount in increasingly non-obvious ways. For > instance, an array defined literally in the source code has an extra > counted reference compared to one which has been modified at runtime. [2] > > Since this is a rather specialised piece of debugging information, not > useful to the average user, I think it should be left to dedicated > debugging tools. XDebug includes an equivalent function that takes a name > and looks it up in the symbol table, avoiding some of the worst issues [3]. > I'm not familiar with PHPDBG, and it doesn't seem to have much > documentation, but I assume it would be able to display this as well. > > I notice there's a draft for an omnibus "deprecations for PHP 8.1" RFC > [4]. Should I add this there, or raise a separate RFC? > > Refs: > 1: https://www.php.net/debug-zval-dump > 2: https://3v4l.org/DVi3f > 3: https://xdebug.org/docs/all_functions#xdebug_debug_zval > 4: https://wiki.php.net/rfc/deprecations_php_8_1 > > Regards, > -- > Rowan Tommins > [IMSoP] Can't say I've had much use for debug_zval_dump(), but I don't really see the motivation for removing it either. For PHP 8.1, I have already adjusted it to dump "interned" instead of a refcount for interned strings and immutable arrays. If we additionally change it to explicitly print reference wrappers, I believe that debug_zval_dump() will produce a faithful representation. Regards, Nikita --000000000000acb5f705bc56e8b3--