@@ -611,11 +611,18 @@ static PHP_METHOD(V8Object, SetNativeDataProperty) {
611
611
612
612
static PHP_METHOD (V8Object, GetPropertyNames) {
613
613
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 );
614
617
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) {
616
619
return ;
617
620
}
618
621
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
+
619
626
PHP_V8_VALUE_FETCH_WITH_CHECK (getThis (), php_v8_value);
620
627
PHP_V8_CONTEXT_FETCH_WITH_CHECK (context_zv, php_v8_context);
621
628
@@ -629,7 +636,10 @@ static PHP_METHOD(V8Object, GetPropertyNames) {
629
636
PHP_V8_TRY_CATCH (isolate);
630
637
PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE (php_v8_value);
631
638
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));
633
643
634
644
PHP_V8_MAYBE_CATCH (php_v8_context, try_catch);
635
645
PHP_V8_THROW_EXCEPTION_WHEN_EMPTY (maybe_local_array, " Failed to get property names" )
@@ -641,10 +651,12 @@ static PHP_METHOD(V8Object, GetPropertyNames) {
641
651
642
652
static PHP_METHOD (V8Object, GetOwnPropertyNames) {
643
653
zval *context_zv;
654
+ zend_long filter = static_cast <zend_long>(v8::PropertyFilter::ALL_PROPERTIES);
644
655
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) {
646
657
return ;
647
658
}
659
+ filter = filter ? filter & PHP_V8_PROPERTY_FILTER_FLAGS : filter;
648
660
649
661
PHP_V8_VALUE_FETCH_WITH_CHECK (getThis (), php_v8_value);
650
662
PHP_V8_CONTEXT_FETCH_WITH_CHECK (context_zv, php_v8_context);
@@ -659,7 +671,7 @@ static PHP_METHOD(V8Object, GetOwnPropertyNames) {
659
671
PHP_V8_TRY_CATCH (isolate);
660
672
PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE (php_v8_value);
661
673
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) );
663
675
664
676
PHP_V8_MAYBE_CATCH (php_v8_context, try_catch);
665
677
PHP_V8_THROW_EXCEPTION_WHEN_EMPTY (maybe_local_array, " Failed to get own property names" )
@@ -1357,10 +1369,14 @@ ZEND_END_ARG_INFO()
1357
1369
1358
1370
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetPropertyNames, ZEND_RETURN_VALUE, 1 , V8\\ArrayObject, 0 )
1359
1371
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 )
1360
1375
ZEND_END_ARG_INFO()
1361
1376
1362
1377
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetOwnPropertyNames, ZEND_RETURN_VALUE, 1 , V8\\ArrayObject, 0 )
1363
1378
ZEND_ARG_OBJ_INFO(0 , context, V8\\Context, 0 )
1379
+ ZEND_ARG_TYPE_INFO(0 , filter, IS_LONG, 0 )
1364
1380
ZEND_END_ARG_INFO()
1365
1381
1366
1382
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_php_v8_object_GetPrototype, ZEND_RETURN_VALUE, 0 , V8\\Value, 0 )
0 commit comments