ID: 28538 Updated by: [EMAIL PROTECTED] Reported By: john at web-imagineer dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: SunOS PHP Version: 4CVS-2004-05-27 (stable) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You're setting a *character* to an empty string, which evaluates as 0 here. Use chop() or similar to get rid of it. Previous Comments: ------------------------------------------------------------------------ [2004-05-27 08:31:26] john at web-imagineer dot com Description: ------------ this would probably make more immediate sense if you look at the code and the output result first, but heres the basics.. this is weird.... 1) i have a string: "10,11,12,13,14," 2) i remove the final comma by doing $groupstr[strlen($groupstr)-1]=""; 3) i now have "10,11,12,13,14" 4) heres the weird part...i do mysql_escape_string() on it and i get: 10,11,12,13,14\0 basically, a visible \0 what looks like it should be a null is added to the end of the string. Reproduce code: --------------- <? //This is really wacky (the mysql_escape_string output) $groupstr="10,11,12,13,14,"; print $groupstr."<BR>"; $groupstr[strlen($groupstr)-1]=""; print $groupstr."<BR>"; print mysql_escape_string($groupstr); print "<BR><BR><BR>"; //This works fine $groupstr="10,11,12,13,14,"; print $groupstr."<BR>"; $groupstr=substr($groupstr,0,strlen($groupstr)-1); print $groupstr."<BR>"; print mysql_escape_string($groupstr); ?> Expected result: ---------------- 10,11,12,13,14, 10,11,12,13,14 10,11,12,13,14 10,11,12,13,14, 10,11,12,13,14 10,11,12,13,14 Actual result: -------------- 10,11,12,13,14, 10,11,12,13,14 10,11,12,13,14\0 10,11,12,13,14, 10,11,12,13,14 10,11,12,13,14 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28538&edit=1