Browse Source

Fixed problems with the new nl2br() and beautified the code a little.

Closes #19858.
migration/unlabaled-1.29.2
Sander Roobol 24 years ago
parent
commit
524c9ef26a
  1. 6
      ext/standard/string.c

6
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);
}

Loading…
Cancel
Save