summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
authorSander Roobol <sander@php.net>2002-10-11 12:42:01 +0000
committerSander Roobol <sander@php.net>2002-10-11 12:42:01 +0000
commit524c9ef26ae2cfa6ed9b0be7c4d4a37581132a30 (patch)
tree18fa1f147364736815d2b79e06b3b0a4877f49d6 /ext/standard/string.c
parent4da5ec89657d072071855d80cb0fad30e83d83f6 (diff)
downloadphp-git-524c9ef26ae2cfa6ed9b0be7c4d4a37581132a30.tar.gz
Fixed problems with the new nl2br() and beautified the code a little.
Closes #19858.
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 1f8db2a3bb..bb6f7a47e5 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3061,10 +3061,10 @@ PHP_FUNCTION(nl2br)
}
if (repl_cnt == 0) {
- RETURN_STRINGL(str, Z_STRLEN_PP(zstr), 1);
+ RETURN_STRINGL(Z_STRVAL_PP(zstr), Z_STRLEN_PP(zstr), 1);
}
- new_length = Z_STRLEN_PP(zstr) + repl_cnt * 6;
+ new_length = Z_STRLEN_PP(zstr) + repl_cnt * (sizeof("<br />") - 1);
tmp = target = emalloc(new_length + 1);
str = Z_STRVAL_PP(zstr);
@@ -3091,7 +3091,7 @@ PHP_FUNCTION(nl2br)
str++;
}
- *target = 0;
+ *target = '\0';
RETURN_STRINGL(tmp, new_length, 0);
}