Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130251 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 B81901A00BC for ; Wed, 4 Mar 2026 20:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772657170; bh=TIA2hEg4Ilos6P7UhnX/kvGONGPs2WfnnxvHVVOvzR8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aYQ+5ZojN72y0gg/Dl7+2Leg/wU3JoyK9jUa2tV65LgHPtA7sUblLYrjHethXoUoV mfIXrPrIcqLENMHRP4cZwzzy+JsOpA8EouIyHf8NStF/FGszJwpVMBQ3I8OGJDchvW kyrXG6qD4Cxl7Fl6jRMyM5pGtiPPhUGYoc2d/j4G+oJ4+lrjyGUkUkWBQWv5zrOa2m odyGpBrpRWtuqf1UDsD29FjG3kf7G+ivZg1uPti9hw4No3hjTIFx9Xg7gub/xLLxO8 xN8WKZcCl9ME+tWWLH1RqLJzFW/0nJaeQ1HZx8DWqxpY2Umj9A/AUL8a906kp2iK7i BJv+biP/OwMrA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3BB59180606 for ; Wed, 4 Mar 2026 20:46:06 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [178.154.239.144]) (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 ; Wed, 4 Mar 2026 20:46:05 +0000 (UTC) Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c1e:489c:0:640:8d6b:0]) by forward500b.mail.yandex.net (Yandex) with ESMTPS id 95771C1CA4 for ; Wed, 04 Mar 2026 23:45:58 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id vjv1Pt6GbmI0-2NjNZpok; Wed, 04 Mar 2026 23:45:58 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1772657158; bh=TIA2hEg4Ilos6P7UhnX/kvGONGPs2WfnnxvHVVOvzR8=; h=To:Subject:Message-ID:References:Date:From:In-Reply-To:Cc; b=tIw/eImzQZLDvDynrlgji959dmuj4CHnlSAbhIPrKSX5660t6BbB9LGB2mFKBOfGi ixnzoa2BZkiqRQ6fvCb68Y0zvMLFqfbi3ihZIPV/9qbbD+ukoxWFeh2bAJsLmpKfP+ E2y1gKzo4pAoFgXvcj+RkRd6K+Out8JWcQMgsxqk= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@php.watch Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b936331786dso786744166b.3 for ; Wed, 04 Mar 2026 12:45:57 -0800 (PST) X-Gm-Message-State: AOJu0YwV06tPlx2cENEX2lxgRDD3CWP9oMOdNHSf4Z2OPT7z7aHMM0HP m7IOUBs7X8rsgcidapCsFcIxmt6s+KM4eJae92n3RLUd6JNcPf97uwtMJpvi67ZeGMvodMU9QRY Fr99nR/LjmTZ+x8vXAZW3qVpKX/wNKrg= X-Received: by 2002:a17:906:6a1b:b0:b84:40d3:43e7 with SMTP id a640c23a62f3a-b93f111bef2mr196259366b.6.1772657156897; Wed, 04 Mar 2026 12:45:56 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <48497C73-5009-4ABC-A83A-702EFD4FAB7F@cmpct.info> In-Reply-To: <48497C73-5009-4ABC-A83A-702EFD4FAB7F@cmpct.info> Date: Thu, 5 Mar 2026 02:15:00 +0530 X-Gmail-Original-Message-ID: X-Gm-Features: AaiRm52O0kcpA7YPhJP5TG5X7BB8J8B2pIkiat4q3U1bwxIg7boGL481oAu8uc8 Message-ID: Subject: Re: [PHP-DEV] Displaying function arguments in errors To: Calvin Buckley Cc: PHP internals Content-Type: text/plain; charset="UTF-8" From: ayesh@php.watch (Ayesh Karunaratne) > I'm dusting off an old PR (GH-12276) I had that I had lying around that > I think would be quite useful. > > Currently, errors in PHP can optionally return some parameter info in > the docref call; in practice, few do so, except a few functions. > This means if you're looking at a PHP error log, you can see what > function is failing, but often not why without having to step debug it. > > What this PR will do is effectively turn this: > > ``` > Warning: unlink('/tmp'): Operation not permitted in /Users/calvin/src/chmod.php on line 3 > > Warning: chown('/', 'calvin'): Operation not permitted in /Users/calvin/src/chmod.php on line 4 > > Warning: chmod('/', 511): Operation not permitted in /Users/calvin/src/chmod.php on line 5 > ``` > > Into this: > > ``` > Warning: unlink(/tmp): Operation not permitted in /Users/calvin/src/chmod.php on line 3 > > Warning: chown(): Operation not permitted in /Users/calvin/src/chmod.php on line 4 > > Warning: chmod(): Operation not permitted in /Users/calvin/src/chmod.php on line 5 > ``` > > This should make it easier at a glance to see what goes wrong in a log. > Because this reuses the current infrastructure for stack traces, this > will also handle i.e. sensitive parameters for free. > > Because this may not always be desirable (i.e. log size, logging PII > that wasn't tagged as sensitive, not having to rewrite every .phpt > file), this will be an INI option. We can vote on what should be the > defaults, and what should be done with tests. Note that the docref's > parameter will be displayed if it's turned off (or i.e. out of memory). > > I think this will almost certainly need an RFC; if there's interest, > I'll start working on that. > > Regards, > Calvin > > PR is at: https://github.com/php/php-src/pull/12276 Hi Calvin, I'm glad you are reviving that PR. I think this will be a nice improvement. I was worried that large parameters might pollute the error logs. I tested the PR, and it was a pleasant surprise that the parameters shown in the warning message also follow `zend.exception_string_param_max_len` INI setting and get trimmed to that length. In the RFC, you might also want to mention in the PR that the parameters will be trimmed (just like SensitiveParameters are masked), and code like this will not write the whole parameter to the error log: ```php ini_set('display_error_function_args', '1'); file_put_contents('/', random_bytes(512)) ``` Best regards, Ayesh.