MFB: Fixed "Floating point exception" inside wordwrap()

This commit is contained in:
Jani Taskinen 2007-07-23 11:47:44 +00:00
parent 6b7c17e222
commit 7bfd857fa1
2 changed files with 7 additions and 0 deletions

View File

@ -856,6 +856,11 @@ PHP_FUNCTION(wordwrap)
RETURN_EMPTY_STRING();
}
if (breakcharlen == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Break string cannot be empty");
RETURN_FALSE;
}
if (linelength == 0 && docut) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't force cut when width is zero");
RETURN_FALSE;

View File

@ -27,6 +27,8 @@ $tests = <<<TESTS
"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
FALSE === @wordwrap(chr(0), 0, "")
TESTS;
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');