+ZEND_RESULT_CODE psi_call_frame_do_assert(struct psi_call_frame *frame, enum psi_assert_kind kind) {
+ size_t i = 0;
+ struct psi_assert_stmt *ass;
+
+ while (psi_plist_get(frame->impl->stmts.ass, i++, &ass)) {
+ if (ass->kind == kind) {
+ if (!psi_assert_stmt_exec(ass, frame)) {
+ char *message = psi_assert_stmt_message(ass);
+ zend_throw_exception(kind == PSI_ASSERT_PRE
+ ? spl_ce_InvalidArgumentException
+ : spl_ce_UnexpectedValueException, message, 0);
+ free(message);
+ return FAILURE;
+ }
+ }
+ }
+
+ return SUCCESS;
+}
+