From 92e15f3e5fe4d812475276955170488204b9b984 Mon Sep 17 00:00:00 2001 From: CismonX Date: Thu, 30 May 2019 12:54:12 +0800 Subject: [PATCH] fix --- src/mat.cc | 5 +++-- tests/003-mat-init.phpt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mat.cc b/src/mat.cc index 368f857..00e1f4e 100644 --- a/src/mat.cc +++ b/src/mat.cc @@ -83,17 +83,18 @@ namespace php_arma break; } ZEND_HASH_FOREACH_VAL(Z_ARR_P(row), zval *elem) - if (idx_col > num_cols - 1) { + if (UNEXPECTED(idx_col > num_cols - 1)) { break; } if (UNEXPECTED(!zval_check_scalar(elem))) { - break; + goto end_loop; } native->at(idx_row, idx_col++) = zval_get_scalar(elem); ZEND_HASH_FOREACH_END(); ++idx_row; idx_col = 0; ZEND_HASH_FOREACH_END(); + end_loop: RETVAL_OBJ(zobj); } diff --git a/tests/003-mat-init.phpt b/tests/003-mat-init.phpt index dd8136c..6c37d22 100644 --- a/tests/003-mat-init.phpt +++ b/tests/003-mat-init.phpt @@ -1,5 +1,5 @@ --TEST-- -Test for initialization of `Mat` +Test for initialization of `Mat`. --SKIPIF--