@@ -333,6 +333,17 @@ static PHP_METHOD(Cursor, isDead)
333333 RETURN_BOOL (!mongoc_cursor_more (intern -> cursor ));
334334} /* }}} */
335335
336+ #if PHP_VERSION_ID >= 80000
337+ static PHP_METHOD (Cursor , getIterator )
338+ {
339+ if (zend_parse_parameters_none () == FAILURE ) {
340+ return ;
341+ }
342+
343+ zend_create_internal_iterator_zval (return_value , getThis ());
344+ }
345+ #endif
346+
336347/* {{{ MongoDB\Driver\Cursor function entries */
337348ZEND_BEGIN_ARG_INFO_EX (ai_Cursor_setTypeMap , 0 , 0 , 1 )
338349 ZEND_ARG_ARRAY_INFO (0 , typemap , 0 )
@@ -348,6 +359,9 @@ static zend_function_entry php_phongo_cursor_me[] = {
348359 PHP_ME (Cursor , getId , ai_Cursor_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
349360 PHP_ME (Cursor , getServer , ai_Cursor_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
350361 PHP_ME (Cursor , isDead , ai_Cursor_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
362+ #if PHP_VERSION_ID >= 80000
363+ PHP_ME (Cursor , getIterator , ai_Cursor_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
364+ #endif
351365 ZEND_NAMED_ME (__construct , PHP_FN (MongoDB_disabled___construct ), ai_Cursor_void , ZEND_ACC_PRIVATE | ZEND_ACC_FINAL )
352366 ZEND_NAMED_ME (__wakeup , PHP_FN (MongoDB_disabled___wakeup ), ai_Cursor_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
353367 PHP_FE_END
@@ -502,6 +516,9 @@ void php_phongo_cursor_init_ce(INIT_FUNC_ARGS) /* {{{ */
502516 PHONGO_CE_DISABLE_SERIALIZATION (php_phongo_cursor_ce );
503517 php_phongo_cursor_ce -> get_iterator = php_phongo_cursor_get_iterator ;
504518
519+ #if PHP_VERSION_ID >= 80000
520+ zend_class_implements (php_phongo_cursor_ce , 1 , zend_ce_aggregate );
521+ #endif
505522 zend_class_implements (php_phongo_cursor_ce , 1 , php_phongo_cursor_interface_ce );
506523
507524 memcpy (& php_phongo_handler_cursor , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
0 commit comments