From: Stanislav Malyshev Date: Wed, 13 Dec 2000 10:22:36 +0000 (+0000) Subject: Fix crash when first argument to strtr is empty X-Git-Tag: php-4.0.5RC1~917 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16987ca15f7ad975d1db81bdda845d04c97e6a68;p=php Fix crash when first argument to strtr is empty --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 77addf6911..4bdc04ac51 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1573,6 +1573,11 @@ PHP_FUNCTION(strtr) convert_to_string_ex(str); + /* shortcut for empty string */ + if(Z_STRLEN_PP(str) == 0) { + RETURN_EMPTY_STRING(); + } + if (ac == 2) { php_strtr_array(return_value,(*str)->value.str.val,(*str)->value.str.len,HASH_OF(*from)); } else {