PHP 4.0 Bug #6174 Updated: problem with sprintf, urlencode and string concatenation

From: Date: Mon, 04 Sep 2000 11:27:59 +0000
Subject: PHP 4.0 Bug #6174 Updated: problem with sprintf, urlencode and string concatenation
Groups: php.dev 
Request: Send a blank email to php-dev+get-31920@lists.php.net to get a copy of this message
ID: 6174 User Update by: johnw@cogs.susx.ac.uk Old-Status: Closed Status: Open Bug Type: Misbehaving function Description: problem with sprintf, urlencode and string concatenation I've downloaded and installed PHP 4.0.2 This bug still occurs You can see it happening by going to the URL http://cogslib.cogs.susx.ac.uk/bug.php Please do not class this as fixed - it isn't! Previous Comments: [2000-09-03 07:45:23] waldschrott@php.net Works for me too. Closed due to missing user feedback. --------------------------------------------------------------------------- [2000-08-15 12:38:34] joey@php.net Works for me in latest CVS on Solaris 2.6. Can you try a snapshot (or wait for 4.0.2)? --------------------------------------------------------------------------- [2000-08-15 12:38:07] stas@php.net Failed to reproduce that with latest CVS. Did you try it (available from snaps.php.net?) --------------------------------------------------------------------------- [2000-08-15 12:31:32] johnw@cogs.susx.ac.uk The following script: <? function add_query_string($url, $qs) { return "$url?$qs"; } function url_stem() { return add_query_string("test.php", "arg1=foo"); } function test() { for ($i=0; $i < 10; $i++) { $url=url_stem() . sprintf("&arg2=%s", urlencode("baz")); print("$i - $url<BR>n"); } } test(); ?> fails on ALTERNATE times round the loop, i.e. it produces the output: 0 - test.php?arg1=foo&arg2=baz 1 - 2 - test.php?arg1=foo&arg2=baz 3 - 4 - test.php?arg1=foo&arg2=baz 5 - 6 - test.php?arg1=foo&arg2=baz 7 - 8 - test.php?arg1=foo&arg2=baz 9 - I've boiled this down as much as I can (which is why the code might look a bit silly). PHP is statically linked into Apache 1.3.4 running on a Sun Ultra 1. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6174

« previous php.dev (#31920) next »