summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-06-05 18:00:56 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-06-05 22:11:06 +0200
commit7af04660447768c81b5df3f4642a786aa6c6ca68 (patch)
tree10ffefada0943e183b1e45b25653c2ad0f955515
parenteae3bda9e368c94c7ed4a28b394348c9a3ee4bd4 (diff)
downloadphp-git-7af04660447768c81b5df3f4642a786aa6c6ca68.tar.gz
Convert code path which should never happen to assertion
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 3e49b1ceb3..67fb2b502e 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -147,13 +147,10 @@ U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRuleStatusVec)
int32_t num_rules = fetch_rbbi(bio)->getRuleStatusVec(NULL, 0,
BREAKITER_ERROR_CODE(bio));
- if (BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR) {
- BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR;
- } else {
- // should not happen
- INTL_METHOD_CHECK_STATUS(bio, "rbbi_get_rule_status_vec: failed "
- " determining the number of status values");
- }
+
+ ZEND_ASSERT(BREAKITER_ERROR_CODE(bio) == U_BUFFER_OVERFLOW_ERROR);
+ BREAKITER_ERROR_CODE(bio) = U_ZERO_ERROR;
+
int32_t *rules = new int32_t[num_rules];
num_rules = fetch_rbbi(bio)->getRuleStatusVec(rules, num_rules,
BREAKITER_ERROR_CODE(bio));