Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128396 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 2C1811A00BC for ; Tue, 5 Aug 2025 10:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754389200; bh=/luELELQ6Afgkr3GNiafX6Rw02ry4LwgqvY1v772+G0=; h=Date:From:To:Subject:From; b=lep8FnEu+jEBkcd4a2vpksKYpu4DrCqKbfFvx6jUplxaadEgWHYrIpiek8cCpbfqy xfzRFXsMQHheKfuiCh2EysfxZMuGkYigjnfULIAp435sT37WtpTUNzCTAexpLHz5ZV DIEv9ETZcoKBkkNoEwAbLfafHFZ6r2puH6Q6qhmmz2RTfj3mmDzslXcfmSSsc4bD+Q dU2K4t2ucvi+UbPOgdPSP3tgcdPpQ5GkAHryt8DlFJNnHKbh61E5VUo3uYw4lLd9a4 jeZqPGBDwfN7IG3N9Uc3yc2Hqwf9CTl+uczYc5YgvloYk0QfFy60xTbQJ1g6FMeBoN nFFeTCVTvWyfg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 47D3318004D for ; Tue, 5 Aug 2025 10:19:59 +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.5 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DMARC_PASS,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: No X-Envelope-From: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 ; Tue, 5 Aug 2025 10:19:58 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-45994a72356so19186635e9.0 for ; Tue, 05 Aug 2025 03:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kumbiaphp-com.20230601.gappssmtp.com; s=20230601; t=1754389297; x=1754994097; darn=lists.php.net; h=content-disposition:content-transfer-encoding:mime-version:subject :message-id:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XtchBfMtYOHn6OsHtdmqDYzjtX4oOtpavKAWxJOPRMs=; b=s3eEU2PBl5aMiJxklHc8xFGUrMTMEIzBlJecYL7GXZqXGWc+A+au8lt+Dl4RazStLD 7z8cwOxews05thwyuLvtEsLE6NJwzApaJSaTBSLmFgNZ8TVvGvSMg642LLqGwPS8Unks 4624FxZTa3pBq8NTQ3c4B84+jJp/60GYeW4dKbws++u9FjsaQjEU64t4lZybV7U0H8cA czOCNuy4SxAFRgT8yMeTa2tFoNKJfPoxlPM6AxxVg9YaoDVUIoVFwl2Jo22H0clNyGGW ojEo9ZpHsk2BgtLysBQUe7e8NgW9jKZuByi1T/fDM2LYSxBLuG7i3AqRCzvKitSSz7iq 66AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754389297; x=1754994097; h=content-disposition:content-transfer-encoding:mime-version:subject :message-id:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XtchBfMtYOHn6OsHtdmqDYzjtX4oOtpavKAWxJOPRMs=; b=JT5+wLYBWf60RtmenMkQjZTZGeGl0UJT39vLO5GHlbe/hqUVR7U0I5dDzJMtI/zZQX DUwcSxMR50B/zxAbACnFGyM+hXzYIyD3FjppaE0oW6JLArJ8CMSdQb4AxlRvIXVrJKta jrWjypAPfUumqO9uW4GoG3LP+eEUlSIEEfHDtZMNFhzXsFPybeaIHHiJ9LH8G+IbFcPC YOHjTRkE8QHDzuzNGt6lu/X/vSLAWgSowRTDz1W+BdqrbEgkFHYHDkfH5YoWotFkTH5n 5+a17dkVejC468LKONqFWDmZQXb5l/cdVExWy5FWZlRNOlqNEZAw5M2dJ3ARN6lfkwYK nCVQ== X-Gm-Message-State: AOJu0Ywfcxghqn7mUOD/urSfsiIJhgdnd3cYN4OGaoVYHl4F4am/UCxz 1U1XxnCYcCMy75FIqKnWEYRtNOM5aOYtLYApnWosmwVTnFt9uVr0doSbdEffI/q2dYWlhsZwOeZ XmC51 X-Gm-Gg: ASbGnctyeqwj5zmCi74L2uz1D0HZAG44i6FzJQlhDO9eQ85gAON1UuTmnLKx7nGMmRv Yo7YrfJDwQdcSjx8g+ILUDZasqPhxowVxE2kcA1jyZv5bpHNZNzHcrw08hcAa+pVhQIVIUxt/CO ZSFMQYm41IVL+GDtOFxeFX1ZQ+t9ARV6IOkvPs0eRID7mhouFmaUM8pIn+KdW+xxkNT1hROWYwb mtK+aEdG/v6yJ3z5SYLFoAb+GpBsJuJUgV5WDmxYwmFTQTs/KCE8v0tuHtMer8DrHTr/fIYOPkI Ix2rHgyy9J4Nrb5qQnSiF2E4izHKaoXeBNn87Wg9dPcFaqGKoMYU4ZPxnt5aq3mZsRosnbFtf60 D3jlR4LMatByIKasQ X-Google-Smtp-Source: AGHT+IHyF41jwKAg6nTjx8+1yOcPTN52zi5invjnpS4wnrHBh8NU7/psxKEJnhW5zgOYNC6SYGzHhg== X-Received: by 2002:a05:600c:6305:b0:459:d3e2:d743 with SMTP id 5b1f17b1804b1-459e0ce7d64mr21826925e9.8.1754389297171; Tue, 05 Aug 2025 03:21:37 -0700 (PDT) Received: from joan-PC ([37.152.87.60]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c453aeasm19186556f8f.40.2025.08.05.03.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Aug 2025 03:21:36 -0700 (PDT) Date: Tue, 5 Aug 2025 12:21:35 +0200 To: "=?utf-8?Q?internals=40lists.php.net?=" Message-ID: <7979EE7A-71B7-46C6-BBE8-EC67196EC1A2@getmailspring.com> Subject: [PHP-DEV] Use header_handler in CLI SAPI X-Mailer: Mailspring Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline From: joanhey@kumbiaphp.com (Joan Miquel Abrines) Hi, I created a issue https://github.com/php/php-src/issues/12304 and later the PR https://github.com/php/php-src/pull/16145 about the headers in CLI= . But both remains stalled, so I'll present it here. The CLI SAPI don't send headers, and for that it's OK that the=C2=A0sapi=5Fcli=5Fsend=5Fheaders()=C2=A0do nothing. But we can't use the normal headers, cookies, session, ... functions from CLI, that later we can take with the headers=5Flist(). =46rom PHP 8.0 we can disable the functions, and override them. But later= we need an spiral of changes: setcookie, session, .... This problem is fixed with change only 1 line in the cli=5Fsapi=5Fmodule from php-src: sapi=5Fcli=5Fheader=5Fhandler, / header handler / for =20 NULL, / header handler / So the CLI will use the fallback core header=5Fhandler and all the functions will work with CLI, that now do nothing. And still the CLI will never sent the headers. This change don't break backward compatibility, as now all these functions do nothing in CLI. And I think that this change don't need an R=46C. In my project https://github.com/joanhey/AdapterMan we override them, to demonstrate that is possible, and run with normal php files and framework= s. But we need to waste a lot of time and effort to maintain it, when with 1 line changed in php-src it's ready. This change it is not only for Adapterman, but to simplify the creation of new CLI frameworks than improve the ecosystem. Another benefit of this change is that we can test headers from CLI, now we can't do it with phpunit, pest, ... The PR come with tests, and also we run a compiled php with Adapterman without problems. Next Steps Open more functions to CLI SAPI, like populate array from request data stream, to simplify the creation of CLI frameworks. Adapterman have demonstrated than CLI frameworks can be faster than C frameworks like Swoole, =46rankenphp, ... but we need to simplify the cre= ation. But this need an R=46C. Sincerely, Joan Miquel Abrines