X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqres.c;h=e9608efc8024b1fe5a6dc4c13f5bde97090a8f82;hp=154cd961a39a0eb4d5f5d0ebdc83f494686b4459;hb=d3e3e97737cda9dafbb17c9076251c09a92bdf78;hpb=80a38048f8355392d81e23f4b3a27a8e77d58214 diff --git a/src/php_pqres.c b/src/php_pqres.c index 154cd96..e9608ef 100644 --- a/src/php_pqres.c +++ b/src/php_pqres.c @@ -1195,8 +1195,22 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqres_getIterator, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(pqres, getIterator) { - ZEND_PARSE_PARAMETERS_NONE(); - zend_create_internal_iterator_zval(return_value, ZEND_THIS); + zend_error_handling zeh; + ZEND_RESULT_CODE rv; + + zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh); + rv = zend_parse_parameters_none(); + zend_restore_error_handling(&zeh); + + if (SUCCESS == rv) { + php_pqres_object_t *obj = PHP_PQ_OBJ(getThis(), NULL); + + if (!obj->intern) { + throw_exce(EX_UNINITIALIZED, "pq\\Result not initialized"); + } else { + zend_create_internal_iterator_zval(return_value, getThis()); + } + } } static zend_function_entry php_pqres_methods[] = {