diff --git a/ext/standard/string.c b/ext/standard/string.c index c2f29baec7732..cbdf6efb2a969 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2194,8 +2194,8 @@ PHP_FUNCTION(chunk_split) ZEND_PARSE_PARAMETERS_END(); if (chunklen <= 0) { - php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero"); - RETURN_FALSE; + zend_throw_error(NULL, "Chunk length should be greater than zero"); + return; } if ((size_t)chunklen > ZSTR_LEN(str)) { diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt index 8650f2cb92f80..bea49d24b4892 100644 Binary files a/ext/standard/tests/strings/chunk_split_variation5.phpt and b/ext/standard/tests/strings/chunk_split_variation5.phpt differ diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index 9804ee21e13f7..15c224962e103 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -50,6 +50,8 @@ for($count = 0; $count < count($values); $count++) { var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); } catch (TypeError $e) { echo $e->getMessage(), "\n"; + } catch (\Error $e) { + echo $e->getMessage() . "\n"; } } @@ -58,18 +60,14 @@ echo "Done" --EXPECTF-- *** Testing chunk_split() : different 'chunklen' with heredoc 'str' *** -- Iteration 1 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero -- Iteration 2 -- string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: ::: ::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.::: :::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t::: :::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::" -- Iteration 3 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero -- Iteration 4 -- string(129) "This's heredoc string with and white space char. @@ -88,7 +86,5 @@ chunk_split():::" -- Iteration 7 -- chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero Done