ID: 24285 User updated by: webmaster at microwebsolutions dot com Reported By: webmaster at microwebsolutions dot com Status: Open Bug Type: Strings related Operating System: Windows NT 5 (IIS 4+) PHP Version: 4.3.2 New Comment:
> Note: $NewCount=CartCount+1; The bug still exists; I just wanted you to know that the $ in front of CartCount accidently got erased while editing the script for notations. The script is working and in tact. I haved tested the output and more; the bug is still there. Nathan Previous Comments: ------------------------------------------------------------------------ [2003-06-22 08:21:29] webmaster at microwebsolutions dot com Description: ------------ Cookies: I found that you can use multiple cookies, but a bug is preventing me from numbering my cookies using a counter. Example: setcookie("This_1_cookie","Testing 1"); As you can see here, the "1" represents a counter, but in this case, there are no $variables in its place; this will output perfect. Now, take a number or any string with a number in it, and pop it in there. $i = 1; $MyCookieName="This_$i_cookie"; setcookie($MyCookieName,"Testing 1"); If you have done exactly as above, you will see the following name in your Cookie file: This_ It cuts off right before the number.. But if you tried the one at the top, you will notice the entire string is there. Why is this an issue? Reproduce code: --------------- $NewCount=CartCount+1; # NewCount should be 1 now.. if not, you can make it 1. setcookie ("CartCount", $NewCount, time()+259200); $newcookie="Quantity[1] ItemName[$ItemName] ItemDescription[$ItemDescription] ItemPrice[$ItemPrice] ItemTax[$ItemTax] ItemShipping[$ItemShipping]"; $CookieName="Cookie_$NewCount_Name"; # Even if $NewCount was empty, it should still fill in the cookie name with "Cookie__Name" But it doesn't.. It cuts off before the numeric.. BUT ONLY WHEN USING A VAR! I HATE THIS! setcookie ($CookieName, $newcookie, time()+259200); echo "NEW CART ITEM [$NewCount] <br>$newcookie"; } Expected result: ---------------- In your temporary internet files, you will notice that the COOKIE'S NAME will be cut off before the number, making it impossible to write a number field to a string without SetCookie realizing (I have no idea why, but I can't get it to work..) that it is not something other than a typed string. Can you guys figure out why I get this bug? Is there a fix? Actual result: -------------- Cookie_ Quantity%5B1%5D+ItemName%5Bnnnnnnn%5D+ItemDescription%5BThe+Item+is+Tall%5D+ItemPrice%5B45%5D+ItemTax%5B5%5D+ItemShipping%5B15%5D%BB localhost/ 1024 533338368 29571867 2694675152 29571263 * ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24285&edit=1