Fix crash when first argument to strtr is empty

This commit is contained in:
Stanislav Malyshev 2000-12-13 10:22:36 +00:00
parent 62f626b157
commit 16987ca15f

View File

@ -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 {