cvs: php4 /ext/standard string.c /ext/standard/tests/strings strtr.phpt

From: Date: Thu, 13 Sep 2001 10:48:41 +0000
Subject: cvs: php4 /ext/standard string.c /ext/standard/tests/strings strtr.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7414@lists.php.net to get a copy of this message
thies Thu Sep 13 06:48:41 2001 EDT Added files: /php4/ext/standard/tests/strings strtr.phpt Modified files: /php4/ext/standard string.c Log: fix strtr() when called with two parameters. this has been broken for some time! guys, when "optimizing" functions you _shoudl_ write a testcase for the working function and make _sure_ that it works afterwards! Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.239 php4/ext/standard/string.c:1.240 --- php4/ext/standard/string.c:1.239 Sun Sep 9 08:55:48 2001 +++ php4/ext/standard/string.c Thu Sep 13 06:48:40 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.239 2001/09/09 12:55:48 derick Exp $ */ +/* $Id: string.c,v 1.240 2001/09/13 10:48:40 thies Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1926,7 +1926,7 @@ while (zend_hash_get_current_data_ex(hash, (void **)&entry, &hpos) == SUCCESS) { switch (zend_hash_get_current_key_ex(hash, &string_key, &string_key_len, &num_key, 0, &hpos)) { case HASH_KEY_IS_STRING: - len = string_key_len; + len = string_key_len-1; if (len > maxlen) maxlen = len; if (len < minlen) minlen = len; break; Index: php4/ext/standard/tests/strings/strtr.phpt +++ php4/ext/standard/tests/strings/strtr.phpt --TEST-- strtr() function --POST-- --GET-- --FILE-- <?php $trans = array("hello" => "hi", "hi" => "hello","a" => "A","world" => "planet"); echo strtr("# hi all, I said hello world! #", $trans) . "\n"; ?> --EXPECT-- # hello All, I sAid hi planet! #

« previous php.cvs (#7414) next »