diff options
author | Derick Rethans <derick@php.net> | 2001-09-24 08:33:51 +0000 |
---|---|---|
committer | Derick Rethans <derick@php.net> | 2001-09-24 08:33:51 +0000 |
commit | f1ce7daccdfecb19c403933a706dc260df26c21b (patch) | |
tree | 75de6c0504c0c08e5199f7bffcc7704507ddef71 | |
parent | f3b1bc8bc22934dfd0837a4e4f0ba541cc3257d5 (diff) | |
download | php-git-f1ce7daccdfecb19c403933a706dc260df26c21b.tar.gz |
- Fix crash bug (patch by <chocolateboy@lunomail.com>)
-rw-r--r-- | ext/standard/string.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 30302c05c1..c8088dabc6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2990,6 +2990,11 @@ PHP_FUNCTION(nl2br) convert_to_string_ex(str); + /* bail out if the string is empty */ + if (Z_STRLEN_PP(str) == 0) { + RETURN_EMPTY_STRING(); + } + /* Windows style line-endings */ tmp = php_str_to_str((*str)->value.str.val, (*str)->value.str.len, "\r\n", 2, "<br />\r\n", 8, &new_length); if (new_length != (*str)->value.str.len) |