Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127719 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id CF2D11A00BC for ; Thu, 19 Jun 2025 12:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1750336655; bh=sCz+F4i7XswFnrdvcCXvhSrAlfJsQ0B00jitHLA4ua0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DDy83mXrJ86KKuPuYPcUR8U8V4LnKE0I0PEkyksWMQjrYMjUSA5qotVoiutE8RIDD dcldK55LZwrISRWtYmUs+nWlBYXPbGrmgODALwdHEvZuFaBw12t+h7bjQyNZUmBeWi UGnJ5cfBCiiEkvWhce+C1MZix0ski3YJVRhNXez246UWBd6NgORfPxSy46w1pgsQpE kjI2FRN8YRfDllzE5unOrtIb4gYp0e6qpSbPYsbQCcExjlWGAT+YBWzXXUsT5bHkl7 1fFqCeh35TRM6Uv40ah6Xi8vCoyHORDYNG09yb02tTErzO4Xjr7NbySikZ/fKXVZpT Ej9MTyDBOPu9g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED199180061 for ; Thu, 19 Jun 2025 12:37:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 19 Jun 2025 12:37:34 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-553d771435fso745151e87.3 for ; Thu, 19 Jun 2025 05:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750336771; x=1750941571; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LrcBwdWtFY1w80cSr7xRog7DCd6jfG9f+0+f94QrmVg=; b=e7ViKVbDu0kBGbEZqmSDxLUNpRCc1Ht/rcC/xGlJGCsxUcYCgefo+kIUY+fUloB2jK +kIqDWRjZGEuW7I4Xq4qnSrbsctc4/FDsnOG0Ljllk+FtLkdryK1YkJ2is/+rna9kbsV sgQcJu7cUcqMf5jenChff2daYuOmZgXb5Y3o8oL+Fs5hi7jWLAXsJNCw+0p40lVUK4in +qyXyU63rqhb458Ws/K86J8uOfgYehBJicgqBEw8UqQc5RNo9KT/eJxkGGRUG+OlTiPZ ds0cPJ9oki6GkjRVbcG35+C+AR/jK0dhxoiUtJhai1Tplh3EWQiaDMuHqxKUmT6p9Q0M lFnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750336771; x=1750941571; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LrcBwdWtFY1w80cSr7xRog7DCd6jfG9f+0+f94QrmVg=; b=ezFe8EnrCR/dyuPCETZQetyJzavD9NtS/k/QLEZgsv1VL76ztrL6pJGzP8iox+YX+D uzxsU4qEWP9/vLwL16tXIgRmtg5g2fEtpxtUoPHStZm2NyBB/w/gb8UxiThI7wio6lBN q7717Vu6sjNrZ79+AsZgWj8c+gt+TDLvVIEbEXIfVr1jsW5v0N1HuE6e/p5uQvLjIRmZ WpV7bxR2wXe2yjxcEiUESBU30Ehxm0Mq09xdfVmYenF3Lvhcbvl9HgzwQdkxYiDDONxl G/i6a1fZuyTqV2EsP1l9CNCQ/uV5WkYnAmweYmeSDdUXHHImkevyz+c/C3m8+zQ9WKWY 1mew== X-Gm-Message-State: AOJu0YyIlktBPROGM8GphWUjvxcaZFIm2qY3dwF20ykC5+1iTHfqtB81 qdEWs0rMZBAQ3TZii/r5yyahG/zHWBiS9/KIkOVi/X5wgi8Da3iVYaohKzm19snOG+3VIgRXvD3 oBTvez76QvM+E4Gl1+75x18OANIDws7Y= X-Gm-Gg: ASbGncuFxLFGTqnEjajXoOjFTIU3D+aG+uE8XolfQq9uP/xWl080itgz30WAPaD3QKR szPKWCWlHhAQa6GzvBD5ViP7sNk9srigU8xU3V6MXSV80DnbYY57q1I2U0kdDb0yiw8fi/6SEQl 2hYxYCFcgm1pHOeIDuEC8dA+HYQl7Rl3vPpg5sJeLVS6ozYhpQTc/oZaA= X-Google-Smtp-Source: AGHT+IGem4AGQ5UMGl2DxfSCzCUUZ8ICJr8LiqOwOvup2eZ5eTdLIZiV035bkMqAFJC7Rb4P9oyDHMuzCycIUXpaZ+w= X-Received: by 2002:a05:6512:b0b:b0:549:38eb:d694 with SMTP id 2adb3069b0e04-553b6f1a1b9mr5335156e87.26.1750336770754; Thu, 19 Jun 2025 05:39:30 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 19 Jun 2025 14:39:19 +0200 X-Gm-Features: Ac12FXwd-gvz4vTUWI8rNpDZ3DP2x0b8QHk05Zxe8BeM8qTg-aDYEpc52SDfAyQ Message-ID: Subject: Re: [PHP-DEV] Pre-RFC: dd() and dump() functions for PHP core To: Larry Garfield , Braunson Yager Cc: php internals Content-Type: multipart/alternative; boundary="000000000000754d9d0637ec09e8" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000754d9d0637ec09e8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mar. 17 juin 2025 =C3=A0 23:22, Larry Garfield = a =C3=A9crit : > On Tue, Jun 17, 2025, at 2:54 PM, Braunson Yager wrote: > > Hi internals, > > > > I'd like to gauge interest in adding two debugging functions to PHP > > core: dd() and dump(). > > > > *Background* > > Currently, developers rely on userland solutions like Laravel's dd() > > helper or Symfony's VarDumper for enhanced debugging output. These > > tools are widely adopted across the PHP ecosystem, suggesting strong > > demand for better debugging primitives. > > > > *Proposal Overview > > *- dd($var, ...$vars) - "dump and die" - outputs formatted debug info > > and terminates execution > > - dump($var, ...$vars) - outputs formatted debug info and continues > > execution > > > > *Enhanced Features Over Existing Solutions > > *- Native performance (no userland overhead) > > - Stack trace integration > > - Memory usage reporting > > - Execution timing (potentially) > > - Better CLI formatting > > > > *Why Core vs Userland? > > *Similar to how var_dump() provides basic introspection, these > > functions would offer enhanced debugging capabilities that benefit the > > entire ecosystem, not just framework users. > > > > *Implementation* > > I'm seeking collaboration with an experienced PHP core developer for > > the C implementation. I can handle the RFC documentation, testing, etc. > > I have experience with the Laravel/Symfony codebases. > > > > *Before drafting a formal RFC, I'd appreciate feedback on: > > *1. General appetite for enhanced debugging functions in core > > 2. Concerns about naming conflicts with existing userland helpers > > 3. Preferred feature scope > > > > Thoughts? > > > > Best regards, > > Braunson Yager > > What exactly would dump() offer that's different/better than var_dump() > already does today? Is it just a pretty-printed var_dump()? I don't > really see a need for that. > > --Larry Garfield > You should give dump() a try Larry, the benefits are self-explanatory ;) About the proposal itself, as the author of Symfony's VarDumper (which is also what Laravel uses under the hood), I'm definitely against it: having the implementation in userland gives way more freedom to innovate on the topic. Eg the number of casters is increasing version after version. Moving this capability to php-src devs would kinda freeze everything. About casters, it's an API provided by VarDumper to define per-type custom representation logic. (There are more APIs provided by the component, and used by third parties, eg PsySH). This aspect is ignored in the state of the proposal. About the naming dump/dd: while php-src could ignore that these functions are widely used in userland, it should NOT, so the name should be different= . About the perf benefit, it's void to me: I'm not aware of anyone using dumps in perf-critical code paths (the existing logic is already optimized enough for all practical use cases.) Then remains the will to make this work out of the box. I tend to agree with this but the proposed solution has too many drawbacks (the main ones listed above). It should be noted that symfony/var-dumper is a standalone component, so one can trivially use it outside of any framework. Just require it and you'll have the functions in any PHP apps. Cheers, Nicolas --000000000000754d9d0637ec09e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Le= =C2=A0mar. 17 juin 2025 =C3=A0=C2=A023:22, Larry Garfield <larry@garfieldtech.com&g= t; a =C3=A9crit=C2=A0:
On Tue, Jun 17, 2025, at 2:54 PM, Braunson Yager wrote:
> Hi internals,
>
> I'd like to gauge interest in adding two debugging functions to PH= P
> core: dd() and dump().
>
> *Background*
> Currently, developers rely on userland solutions like Laravel's dd= ()
> helper or Symfony's VarDumper for enhanced debugging output. These=
> tools are widely adopted across the PHP ecosystem, suggesting strong <= br> > demand for better debugging primitives.
>
> *Proposal Overview
> *- dd($var, ...$vars) - "dump and die" - outputs formatted d= ebug info
> and terminates execution
> - dump($var, ...$vars) - outputs formatted debug info and continues > execution
>
> *Enhanced Features Over Existing Solutions
> *- Native performance (no userland overhead)
> - Stack trace integration
> - Memory usage reporting
> - Execution timing (potentially)
> - Better CLI formatting
>
> *Why Core vs Userland?
> *Similar to how var_dump() provides basic introspection, these
> functions would offer enhanced debugging capabilities that benefit the=
> entire ecosystem, not just framework users.
>
> *Implementation*
> I'm seeking collaboration with an experienced PHP core developer f= or
> the C implementation. I can handle the RFC documentation, testing, etc= .
> I have experience with the Laravel/Symfony codebases.
>
> *Before drafting a formal RFC, I'd appreciate feedback on:
> *1. General appetite for enhanced debugging functions in core
> 2. Concerns about naming conflicts with existing userland helpers
> 3. Preferred feature scope
>
> Thoughts?
>
> Best regards,
> Braunson Yager

What exactly would dump() offer that's different/better than var_dump()= already does today?=C2=A0 Is it just a pretty-printed var_dump()?=C2=A0 I = don't really see a need for that.

--Larry Garfield


You sho= uld give dump() a try Larry, the benefits are self-explanatory ;)

About the proposal itself, as the author of Symfony's V= arDumper (which is also what Laravel uses under the hood), I'm definite= ly against it: having the implementation in userland gives way more freedom= to innovate on the topic. Eg the number of casters is increasing version a= fter version. Moving this capability to php-src devs would kinda freeze eve= rything. About casters, it's an API provided by VarDumper to define per= -type custom representation logic. (There are more APIs provided by the com= ponent, and used by third=C2=A0parties, eg PsySH). This aspect=C2=A0is igno= red in the state of the=C2=A0proposal.

About the n= aming dump/dd: while php-src could ignore that these functions are widely u= sed in userland, it should NOT, so the name should be different.
=
About the perf benefit, it's void to me: I'm not awa= re of anyone using dumps in perf-critical code paths (the existing logic is= already optimized enough for all practical use cases.)

Then remains the will to make this work out of the box. I tend to agr= ee with this but the proposed solution has too many drawbacks (the main one= s listed above). It should be noted that symfony/var-dumper is a standalone= component, so one can trivially use it outside of any framework. Just requ= ire it and you'll have the functions in any PHP apps.

Cheers,
Nicolas
--000000000000754d9d0637ec09e8--