ID: 19673 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: HTTP related Operating System: Linux 2.2.17 (Debian potato) PHP Version: 4.2.2 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-09-30 08:09:18] [EMAIL PROTECTED] When setting multiple cookies in a script, only the last cookie remains. I tested it by: setcookie("one", "1"); setcookie("two", "2"); setcookie("three", "3"); Then I fetched the script via telnet to see the headers, and only one header was set: Set-Cookie: three=3 I tracked it down to ext/standard/head.c, end of the php_setcookie-funkction. There, sapi_add_header gets executed. sapi_add_header is a macro to sapi_add_header_ex with the replace-bit SET! That means, every cookie gets overwritten by its predecessor. In fact, only the last cookie remains. I fixed it by exchanging the line return sapi_add_header(cookie, strlen(cookie), 0); with return sapi_add_header_ex(cookie, strlin(cookie), 0, 0 TSRMLS_CC); After compiling the patched PHP, setting multiple cookies succeedes. Is that a bug in PHP or was it written on purpose, that only one cookie can be set? I could have changed the macro in main/SAPI.h, but the macro is used in ext/zlib/zlib.c and ext/session/session.c and I didn't want to confuse them. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19673&edit=1