Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

''WPGraphQL for ACF'' blocks the proper function of ACF #228

Open
3 tasks done
ChristinaSpyrou98 opened this issue Jul 23, 2024 · 3 comments
Open
3 tasks done

''WPGraphQL for ACF'' blocks the proper function of ACF #228

ChristinaSpyrou98 opened this issue Jul 23, 2024 · 3 comments
Labels
needs: reproduction This issue needs to be reproduced independently type: bug Issue that causes incorrect or unexpected behavior

Comments

@ChristinaSpyrou98
Copy link

Description

Dear all,
Latelty I'm facing an issue with the ''WPGraphQL for ACF''. Once I'm activating this plug-in, I can't open the settings drop-down of any field inside a field group. Also I dont see the custom fields inside the pages.

Can I ask for your contribution to the solution of the bug?
Kindly,
Christina

Screenshot 2024-07-23 104432

Steps to reproduce

Activate ''WPGraphQL for ACF''

PHP or JSON export of the ACF Field Group(s)

acf-export-2024-07-23.json

Additional context

No response

WPGraphQL Version

1.27.2

WPGraphQL For ACF Version

2.2.0

ACF (Advanced Custom Fields) Version. Free or Pro?

6.3.4 (PRO)

WordPress Version

6.6

PHP Version

8.3.9 (Supports 64bit values)

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
@josephfusco josephfusco added type: bug Issue that causes incorrect or unexpected behavior needs: reproduction This issue needs to be reproduced independently labels Jul 23, 2024
@josephfusco
Copy link
Member

Hey @ChristinaSpyrou98 thank you for opening this issue and providing an export! We will be looking at this soon and will provide updates here!

@jonmichaeldarby
Copy link

I'm also experiencing this issue immediately after activating wpgraphql-acf. It occurs on Advanced Custom Fields Pro 6.3.4 and 6.3.2.1 (other versions may be affected, but I tested these specifically).

Further, I have the following in my error log:

[23-Jul-2024 19:23:44 UTC] PHP Fatal error:  Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, string given in /wp-content/plugins/wpgraphql-acf/src/FieldType/CloneField.php:26
Stack trace:
#0 /wp-content/plugins/wpgraphql-acf/src/FieldType/CloneField.php(26): array_map(Object(Closure), '')
#1 /wp-content/plugins/wpgraphql-acf/src/AcfGraphQLFieldType.php(317): WPGraphQL\Acf\FieldType\CloneField::WPGraphQL\Acf\FieldType\{closure}(Object(WPGraphQL\Acf\FieldConfig), Object(WPGraphQL\Acf\AcfGraphQLFieldType))
#2 /wp-content/plugins/wpgraphql-acf/src/FieldConfig.php(237): WPGraphQL\Acf\AcfGraphQLFieldType->get_resolve_type(Object(WPGraphQL\Acf\FieldConfig))
#3 /wp-content/plugins/wpgraphql-acf/src/Registry.php(521): WPGraphQL\Acf\FieldConfig->get_graphql_field_config()
#4 /wp-content/plugins/wpgraphql-acf/src/Registry.php(504): WPGraphQL\Acf\Registry->map_acf_field_to_graphql(Array, Array)
#5 /wp-content/plugins/wpgraphql-acf/src/Registry.php(705): WPGraphQL\Acf\Registry->get_fields_for_field_group(Array)
#6 /wp-content/plugins/wpgraphql-acf/src/FieldType/FlexibleContent.php(85): WPGraphQL\Acf\Registry->register_acf_field_groups_to_graphql(Array)
#7 /wp-content/plugins/wpgraphql-acf/src/AcfGraphQLFieldType.php(317): WPGraphQL\Acf\FieldType\FlexibleContent::WPGraphQL\Acf\FieldType\{closure}(Object(WPGraphQL\Acf\FieldConfig), Object(WPGraphQL\Acf\AcfGraphQLFieldType))
#8 /wp-content/plugins/wpgraphql-acf/src/FieldConfig.php(237): WPGraphQL\Acf\AcfGraphQLFieldType->get_resolve_type(Object(WPGraphQL\Acf\FieldConfig))
#9 /wp-content/plugins/wpgraphql-acf/src/Registry.php(521): WPGraphQL\Acf\FieldConfig->get_graphql_field_config()
#10 /wp-content/plugins/wpgraphql-acf/src/Registry.php(504): WPGraphQL\Acf\Registry->map_acf_field_to_graphql(Array, Array)
#11 /wp-content/plugins/wpgraphql-acf/src/Registry.php(705): WPGraphQL\Acf\Registry->get_fields_for_field_group(Array)
#12 /wp-content/plugins/wpgraphql-acf/src/WPGraphQLAcf.php(112): WPGraphQL\Acf\Registry->register_acf_field_groups_to_graphql(Array)
#13 /wp-includes/class-wp-hook.php(324): WPGraphQLAcf->init_registry(Object(WPGraphQL\Registry\TypeRegistry))
#14 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#15 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#16 /wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php(601): do_action('graphql_registe...', Object(WPGraphQL\Registry\TypeRegistry))
#17 /wp-includes/class-wp-hook.php(324): WPGraphQL\Registry\TypeRegistry->init_type_registry(Object(WPGraphQL\Registry\TypeRegistry))
#18 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#19 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#20 /wp-content/plugins/wp-graphql/src/Registry/TypeRegistry.php(262): do_action('init_graphql_ty...', Object(WPGraphQL\Registry\TypeRegistry))
#21 /wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php(36): WPGraphQL\Registry\TypeRegistry->init()
#22 /wp-content/plugins/wp-graphql/src/WPGraphQL.php(722): WPGraphQL\Registry\SchemaRegistry->get_schema()
#23 /wp-content/plugins/wp-graphql/src/Request.php(155): WPGraphQL::get_schema()
#24 /wp-content/plugins/wp-graphql/src/Router.php(461): WPGraphQL\Request->__construct()
#25 /wp-content/plugins/wp-graphql/src/Router.php(257): WPGraphQL\Router::process_http_request()
#26 /wp-includes/class-wp-hook.php(324): WPGraphQL\Router::resolve_http_request(Object(WP))
#27 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#28 /wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#29 /wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
#30 /wp-includes/class-wp.php(813): WP->parse_request('')
#31 /wp-includes/functions.php(1336): WP->main('')
#32 /wp-blog-header.php(16): wp()
#33 /index.php(17): require('...')
#34 {main}
  thrown in /wp-content/plugins/wpgraphql-acf/src/FieldType/CloneField.php on line 26

If I stop execution of the problematic array_map in /wp-content/plugins/wpgraphql-acf/src/FieldType/CloneField.php on line 26 via:

if ( !is_array($sub_field_group['clone']) ) {
  return 'NULL';
}

I can once again expand the field groups. This workaround introduces another class of problems (I now have a fresh set of graphQL errors related to types and interfaces), but hopefully is useful in narrowing down the problem.

@josephfusco
Copy link
Member

Thanks for the extra information @jonmichaeldarby. We will look into reproducing this and post updates here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: reproduction This issue needs to be reproduced independently type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

No branches or pull requests

3 participants