Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:129636 php.internals:129637 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 67CA01A00BC for ; Wed, 17 Dec 2025 17:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765993069; bh=g9DCfoHy3jw1JcmDIFvkuJ7rj3XgxOehCJPerL+PYwE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=cSPRvqKM2KYOnWwJrj1P6CtQc7DXnKXiAW+0ZOGgse45p+U/hH3hPJ5P6YulxpS5F C7MfT6O1BAlqrkWlZHXNVbvRmA7M2awhFBdDRJ0Gh0t3n1rQyl2kccE42sRA0KIZPt NYVIGLwi3tt7wQT56Y0NGYuax4x+Yh+EMxx4uqmZTt0EGIOY7zC+0YJ8FyYm0Mvqh8 2UPCDk0Ro92lDkUG2oR2Y4I/u2MoZYu/XTnE2IPrv1SCWXpCVXRWTWarZ6iUuevWDc WjyrV82CyNEF/Xgfipiur6Mas/eF78536/S+e6pJhwdqrKds37s6f4D90mGU1pomt0 tVuLbK1410ZhQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 91AE3180057 for ; Wed, 17 Dec 2025 17:37:46 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from alcott.smtp.mailx.hosts.net.nz (alcott.smtp.mailx.hosts.net.nz [43.245.52.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 17 Dec 2025 17:37:45 +0000 (UTC) Received: from 122-57-27-239-adsl.sparkbb.co.nz ([122.57.27.239] helo=[192.168.1.67]) by alcott.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1vVvT0-00GeEE-00 for internals@lists.php.net; Thu, 18 Dec 2025 06:37:38 +1300 Message-ID: <93f7cc06-de78-4a13-b848-fba5c847231a@varteg.nz> Date: Thu, 18 Dec 2025 06:37:16 +1300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Re: Bug inside PHP CLI sessions To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Hosts-DKIM-Check: none From: weedpacket@varteg.nz (Morgan) On 2025-12-18 06:12, Gregory Magarshak wrote: > My apologies. I made a mistake in the minimal examples to reproduce: > > 1. session_id($id); session_start(); echo session_id(); // empty! > > 2. session_id($id); echo "b"; session_start(); echo session_id(); // FINE!! > > 3. echo "a"; session_id($id); echo "b"; session_start(); echo > session_id(); // empty again! > > Sincerely, > Greg Magarshak > > > I tried your minimal reproductions in the CLI and got undefined variable warnings from the $id value. Putting in a literal session id value I get 1. session_id('session17'); session_start(); echo session_id();" > session17 2. session_id('session17'); echo 'b'; session_start(); echo session_id(); > bSession cannot be started after headers have already been sent (sent from Command line code on line 1) in Command line code on line 1 3. echo 'a'; session_id('session17'); echo 'b'; session_start(); echo session_id(); > aSession ID cannot be changed after headers have already been sent > bSession cannot be started after headers have already been sent I get the same results using `php -r`, `php -a`, and putting those lines in files and running them. What else is your framework doing that is being left out of this setup?