|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-02-28 18:16 UTC] robin at willowsv dot com
[2017-02-28 18:21 UTC] spam2 at rhsoft dot net
[2017-03-02 17:52 UTC] robin at willowsv dot com
[2017-03-02 18:38 UTC] spam2 at rhsoft dot net
[2017-03-29 12:13 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2017-03-29 12:13 UTC] ab@php.net
[2017-03-29 18:09 UTC] ab@php.net
-Status: Feedback
+Status: Closed
-Assigned To:
+Assigned To: ab
[2017-03-29 18:09 UTC] ab@php.net
[2017-03-31 10:49 UTC] robin at willowsv dot com
[2017-03-31 10:54 UTC] nikic@php.net
[2017-03-31 11:04 UTC] ab@php.net
[2017-03-31 11:12 UTC] robin at willowsv dot com
[2017-09-12 02:30 UTC] jamwhitl at cisco dot com
[2017-09-12 17:08 UTC] a dot gurevicius at gmail dot com
[2017-09-12 17:38 UTC] ab@php.net
[2017-09-12 18:19 UTC] jamwhitl at cisco dot com
[2017-09-12 18:31 UTC] ab@php.net
[2017-09-12 18:34 UTC] spam2 at rhsoft dot net
[2017-09-12 18:58 UTC] jamwhitl at cisco dot com
[2017-09-24 17:22 UTC] a dot gurevicius at gmail dot com
[2017-10-05 08:40 UTC] a dot gurevicius at gmail dot com
[2017-11-06 11:05 UTC] ca at lsp dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 05:00:01 2025 UTC |
Description: ------------ Periodically PHP will periodically fail to populate the $_COOKIE Super global. The logs will report that _COOKIE is undefined if you check it (depending on the reporting level) and if it's set first it will behave like a non superglobal with normal variable scope. A restart of the Apache/PHP server corrects the issue however it hits sporadically and refused to allow us to sign in. $_SERVER reports cookie data is available. Test script: --------------- <?php echo("Dumping Server!\n"); print_r($_SERVER); echo("\n\nDumping Cookie!\n"); print_r($_COOKIE); // Set Value echo("\n\nSetting Cookie!\n"); $_COOKIE['TEST'] = "TEST"; print_r($_COOKIE); // Echo echo("\n\nTest 1!\n"); test(); echo("\n\nTest 2!\n"); test2(); // Test Function 1 (No Global) function test() { if ( empty($_COOKIE) ) echo("Can't find cookie superglobal!\n"); } else { echo("Dumping Cookie!\n"); print_r($_COOKIE); } } // Test Function 2 (No Global) function test2() { global $_COOKIE; if ( empty($_COOKIE) ) { echo("Can't find cookie superglobal!"); } else { echo("Dumping Cookie!\n"); print_r($_COOKIE); } } ?> Expected result: ---------------- Dumping Server! Array ( [HTTPS] => on [SSL_SESSION_RESUMED] => Initial [HTTP_HOST] => 10.224.130.232 [HTTP_CONNECTION] => keep-alive [HTTP_CACHE_CONTROL] => max-age=0 [HTTP_UPGRADE_INSECURE_REQUESTS] => 1 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 [HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch, br [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8,en-GB;q=0.6 [HTTP_COOKIE] => CMS=18368a69a2b9b1d7a62918213adcf19d; SVMCMS=05bfdca9adaf72b52578668069db639f61652476; PHPSESSID=1b86072d4b839507ae6e7223f3645923 [SystemRoot] => C:\Windows [COMSPEC] => C:\Windows\system32\cmd.exe [WINDIR] => C:\Windows [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.4.25 (Win32) OpenSSL/1.0.2k PHP/7.1.2 [SERVER_PORT] => 443 [DOCUMENT_ROOT] => D:/www/httpdocs [REQUEST_SCHEME] => https [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => D:/www/httpdocs [SERVER_ADMIN] => admin@example.com [SCRIPT_FILENAME] => D:/www/httpdocs/cms/bug.php [REMOTE_PORT] => 62749 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /cms/bug.php [SCRIPT_NAME] => /cms/bug.php [PHP_SELF] => /cms/bug.php [REQUEST_TIME_FLOAT] => 1488303793.707 [REQUEST_TIME] => 1488303793 [argv] => Array ( ) [argc] => 0 ) Dumping Cookie! Array ( [CMS] => 18368a69a2b9b1d7a62918213adcf19d [SVMCMS] => 05bfdca9adaf72b52578668069db639f61652476 [PHPSESSID] => 1b86072d4b839507ae6e7223f3645923 ) Setting Cookie! Array ( [CMS] => 18368a69a2b9b1d7a62918213adcf19d [SVMCMS] => 05bfdca9adaf72b52578668069db639f61652476 [PHPSESSID] => 1b86072d4b839507ae6e7223f3645923 [TEST] => TEST ) Test 1! Dumping Cookie! Array ( [CMS] => 18368a69a2b9b1d7a62918213adcf19d [SVMCMS] => 05bfdca9adaf72b52578668069db639f61652476 [PHPSESSID] => 1b86072d4b839507ae6e7223f3645923 [TEST] => TEST ) Test 2! Dumping Cookie! Array ( [CMS] => 18368a69a2b9b1d7a62918213adcf19d [SVMCMS] => 05bfdca9adaf72b52578668069db639f61652476 [PHPSESSID] => 1b86072d4b839507ae6e7223f3645923 [TEST] => TEST ) Actual result: -------------- Dumping Server! Array ( [HTTPS] => on [SSL_SESSION_RESUMED] => Resumed [HTTP_HOST] => 10.224.130.232 [HTTP_CONNECTION] => keep-alive [HTTP_CACHE_CONTROL] => max-age=0 [HTTP_UPGRADE_INSECURE_REQUESTS] => 1 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 [HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch, br [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8,en-GB;q=0.6 [HTTP_COOKIE] => CMS=18368a69a2b9b1d7a62918213adcf19d; SVMCMS=05bfdca9adaf72b52578668069db639f61652476; PHPSESSID=1b86072d4b839507ae6e7223f3645923 [SystemRoot] => C:\Windows [WINDIR] => C:\Windows [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.4.25 (Win32) OpenSSL/1.0.2k PHP/7.1.2 [SERVER_PORT] => 443 [DOCUMENT_ROOT] => D:/www/httpdocs [REQUEST_SCHEME] => https [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => D:/www/httpdocs [SERVER_ADMIN] => admin@example.com [SCRIPT_FILENAME] => D:/www/httpdocs/cms/bug.php [REMOTE_PORT] => 62746 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /cms/bug.php [SCRIPT_NAME] => /cms/bug.php [PHP_SELF] => /cms/bug.php [REQUEST_TIME_FLOAT] => 1488303761.429 [REQUEST_TIME] => 1488303761 [argv] => Array ( ) [argc] => 0 ) Dumping Cookie! Setting Cookie! Array ( [TEST] => TEST ) Test 1! Can't find cookie superglobal! Test 2! Dumping Cookie! Array ( [TEST] => TEST )