From 7bfd857fa1e762c4ac5c3abd3eba4c95406af147 Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Mon, 23 Jul 2007 11:47:44 +0000 Subject: [PATCH] MFB: Fixed "Floating point exception" inside wordwrap() --- ext/standard/string.c | 5 +++++ ext/standard/tests/strings/wordwrap.phpt | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ext/standard/string.c b/ext/standard/string.c index 8ba1f5371d..0abd0b4cc5 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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; diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt index 66104e3c77..c1f3b05bda 100644 --- a/ext/standard/tests/strings/wordwrap.phpt +++ b/ext/standard/tests/strings/wordwrap.phpt @@ -27,6 +27,8 @@ $tests = <<