@@ -611,11 +611,18 @@ static PHP_METHOD(V8Object, SetNativeDataProperty) {
611611
612612static PHP_METHOD (V8Object, GetPropertyNames) {
613613 zval *context_zv;
614+ zend_long mode = static_cast <zend_long>(v8::KeyCollectionMode::kOwnOnly );
615+ zend_long property_filter = static_cast <zend_long>(v8::PropertyFilter::ALL_PROPERTIES);
616+ zend_long index_filter = static_cast <zend_long>(v8::IndexFilter::kIncludeIndices );
614617
615- if (zend_parse_parameters (ZEND_NUM_ARGS (), " o" , &context_zv) == FAILURE) {
618+ if (zend_parse_parameters (ZEND_NUM_ARGS (), " o|lll " , &context_zv, &mode, &property_filter, &index_filter ) == FAILURE) {
616619 return ;
617620 }
618621
622+ mode = mode ? mode & PHP_V8_KEY_COLLECTION_MODE_FLAGS : mode;
623+ property_filter = property_filter ? property_filter & PHP_V8_PROPERTY_FILTER_FLAGS : property_filter;
624+ index_filter = index_filter ? index_filter & PHP_V8_INDEX_FILTER_FLAGS : index_filter;
625+
619626 PHP_V8_VALUE_FETCH_WITH_CHECK (getThis (), php_v8_value);
620627 PHP_V8_CONTEXT_FETCH_WITH_CHECK (context_zv, php_v8_context);
621628
@@ -629,7 +636,10 @@ static PHP_METHOD(V8Object, GetPropertyNames) {
629636 PHP_V8_TRY_CATCH (isolate);
630637 PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE (php_v8_value);
631638
632- v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetPropertyNames (context);
639+ v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetPropertyNames (context,
640+ static_cast <v8::KeyCollectionMode>(mode),
641+ static_cast <v8::PropertyFilter >(property_filter),
642+ static_cast <v8::IndexFilter>(index_filter));
633643
634644 PHP_V8_MAYBE_CATCH (php_v8_context, try_catch);
635645 PHP_V8_THROW_EXCEPTION_WHEN_EMPTY (maybe_local_array, " Failed to get property names" )
@@ -641,10 +651,12 @@ static PHP_METHOD(V8Object, GetPropertyNames) {
641651
642652static PHP_METHOD (V8Object, GetOwnPropertyNames) {
643653 zval *context_zv;
654+ zend_long filter = static_cast <zend_long>(v8::PropertyFilter::ALL_PROPERTIES);
644655
645- if (zend_parse_parameters (ZEND_NUM_ARGS (), " o" , &context_zv) == FAILURE) {
656+ if (zend_parse_parameters (ZEND_NUM_ARGS (), " o|l " , &context_zv, &filter ) == FAILURE) {
646657 return ;
647658 }
659+ filter = filter ? filter & PHP_V8_PROPERTY_FILTER_FLAGS : filter;
648660
649661 PHP_V8_VALUE_FETCH_WITH_CHECK (getThis (), php_v8_value);
650662 PHP_V8_CONTEXT_FETCH_WITH_CHECK (context_zv, php_v8_context);
@@ -659,7 +671,7 @@ static PHP_METHOD(V8Object, GetOwnPropertyNames) {
659671 PHP_V8_TRY_CATCH (isolate);
660672 PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE (php_v8_value);
661673
662- v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetOwnPropertyNames (context);
674+ v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetOwnPropertyNames (context, static_cast <v8::PropertyFilter >(filter) );
663675
664676 PHP_V8_MAYBE_CATCH (php_v8_context, try_catch);
665677 PHP_V8_THROW_EXCEPTION_WHEN_EMPTY (maybe_local_array, " Failed to get own property names" )
@@ -1357,10 +1369,14 @@ ZEND_END_ARG_INFO()
13571369
13581370PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetPropertyNames, ZEND_RETURN_VALUE, 1 , V8\\ArrayObject, 0 )
13591371 ZEND_ARG_OBJ_INFO(0 , context, V8\\Context, 0 )
1372+ ZEND_ARG_TYPE_INFO(0 , mode, IS_LONG, 0 )
1373+ ZEND_ARG_TYPE_INFO(0 , property_filter, IS_LONG, 0 )
1374+ ZEND_ARG_TYPE_INFO(0 , index_filter, IS_LONG, 0 )
13601375ZEND_END_ARG_INFO()
13611376
13621377PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetOwnPropertyNames, ZEND_RETURN_VALUE, 1 , V8\\ArrayObject, 0 )
13631378 ZEND_ARG_OBJ_INFO(0 , context, V8\\Context, 0 )
1379+ ZEND_ARG_TYPE_INFO(0 , filter, IS_LONG, 0 )
13641380ZEND_END_ARG_INFO()
13651381
13661382PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetPrototype, ZEND_RETURN_VALUE, 0 , V8\\Value, 0 )
0 commit comments