Bug #17663 Updated: setcookie only sets last of multiple cookies
| From: | derick@php.net | Date: | Thu, 20 Jun 2002 11:39:52 +0000 |
| Subject: | Bug #17663 Updated: setcookie only sets last of multiple cookies | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-11552@lists.php.net to get a copy of this message | ||
ID: 17663
Updated by: derick@php.net
Reported By: craig@bioware.com
-Status: Feedback
+Status: Open
Bug Type: Apache2 related
Operating System: RedHat 7.2
PHP Version: 4.0CVS-2002-06-09
New Comment:
That error was fixed in CVS recently, but leaving this open because of
the bad cookies
Previous Comments:
------------------------------------------------------------------------
[2002-06-20 07:22:22] red@tripany.com
Hi,
I've installed Apache 2.0.39 on Debian 2.2 and 2.4, which went fine.
Then installing php 4.2.1, the configure goes fine,
./configure --prefix=/opt/php-4.2.1 --enable-force-cgi-redirect
--enable-ftp --enable-magic-quotes --enable-bcmath --enable-calendar
--enable-dbase --enable-dbx --enable-ftp --enable-gd-native-ttf
--enable-mbstring --enable-track-vars --enable-ucd-snmp-hack
--enable-sockets --enable-sysvsem --enable-sysvshm --enable-yp
--enable-shared=PKGS --enable-debug --enable-memory-limit --with-zlib
--with-gd --with-jpeg-dir=/usr/lib --with-tiff-dir=/usr/lib
--with-png-dir=/usr/lib --with-mysql --with-snmp
--with-apxs2=/opt/httpd-2.0.39/bin/apxs
It finds apache2 support, and suggests using apache2filter (which I
think it should be doing)
but the make gives an error:
gcc -I. -I/usr/local/src/php/php-4.2.1/sapi/apache2filter
-I/usr/local/src/php/php-4.2.1/main -I/usr/local/src/php/php-4.2.1
-I/opt/httpd-2.0.39/include -I/usr/local/src/php/php-4.2.1/Zend
-I/usr/local/include -I/usr/local/src/php/php-4.2.1/ext/mysql/libmysql
-I/usr/include/ucd-snmp -I/usr/local/src/php/php-4.2.1/ext/xml/expat
-D_REENTRANT -I/usr/local/src/php/php-4.2.1/TSRM -DTHREAD=1 -g -O2
-pthread -Wall -DZTS -c php_functions.c -fPIC -DPIC -o
php_functions.lo
php_functions.c:93: parse error
make[3]: *** [php_functions.lo] Error 1
make[3]: Leaving directory
`/usr/local/src/php/php-4.2.1/sapi/apache2filter'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/usr/local/src/php/php-4.2.1/sapi/apache2filter'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/php/php-4.2.1/sapi'
make: *** [all-recursive] Error 1
Now if I delete lines 92, 93 and 94 from
sapi/apache2filter/php_functions.c which are:
#if !MODULE_MAGIC_AT_LEAST(20020506,0)
ADD_STRING(boundary);
#endif
and then continue the make, it all seems to go fine. Make install
copies everything to the right directory and doing a <? phpinfo() ?>
shows that everything should be functioning neatly.
Now the problem!
When writing cookies to a client, sometimes the cookie will not be
written and sometimes it will be - this behaviour is consistent in
terms of site a will never write the cookies, but site b will always
write the cookie! (see code below)
Never works
setcookie("netuser", $row["werknemer_ID"], time()+3600, "/");
setcookie["netlanguage", $row["row_lang"], time()+3600,"/");
setcookie["netlastlogin", $row["last_login"], time()+3600,"/");
$werknemer_ID=$HTTP_COOKIE_VARS["netuser"];
Always works
setcookie("user", $userID, time()+(3600*3), "/")
$userID=$HTTP_COOKIE_VARS["soluser"];
The only thing we've managed to figure out is that in the first
example, we write to the cookie 3 times (using similar statements) and
in the second example we only create the cookie once. Every time we
write to the cookie again, it overwrites (deletes) the old cookies and
replaces it with the last cookie. So what you end up with, is the
netlastlogin cookie, and netuser and netlanguage don't exist on the
client harddrive. This used to work under php4.2.0!
Under apache 2.0.36 and php 4.2.0 compiled with the same settings, I
never experienced this behaviour and I have no idea what's causing it!
Any help is much appreciated!
------------------------------------------------------------------------
[2002-06-09 04:08:13] derick@php.net
The STABLE snapshots are not from the development branch, so change is
that it didn't make it in the 4_2 release branch. You might want to try
a non-stable snapshot which are made from the latest development
branch.
Derick
------------------------------------------------------------------------
[2002-06-09 02:48:31] craig@bioware.com
Hey...
Yes I know that this has been mentioned and *FIXED* before, but with
Apache 2.0.36 and PHP 4.2.1 (and the latest CVS from tonight -
STABLE-200206082100)...
It is STILL an issue. We are trying to set 2 cookies on the same page,
and the second is the only one created!
I've tried everything I can think of -- multiple apache & php versions
-- no luck!
Please take another look at this...
Thanks,
Craig Miller
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17663&edit=1