-
Notifications
You must be signed in to change notification settings - Fork 182
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
acf_get_fields function access array indexes 'key' and 'ID' without checking their existence #266
Comments
I submitted a PR for this problem: |
Hi @simplyrapf Thanks for the PR. Before merging in a solution to this problem, I would first like to replicate it. Are you able to share with me a dev site that demonstrates this PHP error? |
Hey @elliotcondon, I've the same issue if I save local field groups in different folders like this example: https://wphave.de/acf-feldgruppen-automatisch-in-verschiedenen-verzeichnissen-speichern/ After change the code to:
... this solves the PHP notices. And by the way by adding Will be this a part of the upcoming ACF 5.8.8 release? |
Thanks for the update. Is there any chance you are able to replicate this issue on a local or dev site? |
Hey @elliotcondon, thanks for reply, maybe this is helping you: I don't get this issue in every case. However, it seems that this issue is associated with "cloned fields" and "flexible content" when I include local field groups from different locations, e.g.
By adding |
I think this issue is associated with loading different types of field groups: CASE 1: HERE I GET THIS "Undefined index" ISSUE CASE 2: I DON'T GET THIS ISSUE CASE 3: I DON'T GET THIS ISSUE |
interesting. By the sounds of it, this is a conflict created by the Clone field. Thanks for the PHP error trace, this will be very helpful. Is there any chance of getting a dev or staging site to test with? |
@elliotcondon what do you prefer? The sql database file with a duplicator file of the Wordpress installation? |
My preferred method would be a 'Local by Flywheel' export. If it's possible, can you please spin up a fresh WP site in "Local by Flywheel" and try to replicate the issue? Please keep the default theme active and edit the functions.php file with any extra logic needed. If you can replicate the issue, please export the site (from flywheel app, right click the site and click "export") and attach to your next reply. Otherwise, I'll be happy to setup the dev site using duplicator too :) |
@elliotcondon @CreativeDive unfortunately I cannot provide a dev site based of the project that is affected by this issue. I will try to replicate this on a fresh installation of wordpress in order to provide you a copy. However, I should point out that this issue has been raised in your forums and it seems to affect many other users. |
@elliotcondon I also just ran into this issue. It happens for me if I delete a field group (let's call it "My module") that was referenced from another field as clone "All fields from My module field group". When I go to a post edit screen where the clone field is in use, I get these errors:
Here's my debug backtrace:
|
Unfortunately I have not yet managed to create a test environment. Sorry. Maybe you can do it @hirasso ? That would help @elliotcondon to solve that issue. |
@elliotcondon I run into this issue again on a new WordPress installation. This time the taxonomy admin page (category or tags) loads extremely slow and show a lot of fields with totally other locations: Here more about this issue: To wrap this condition with My question, why you don't add this litte fix to the ACF core? It seems that the error appears with several users and this fix is helping very well. I can't say why this is happen. I've a other installation and it runs very well on the taxonomy admin page. |
Thanks for the bug update. This screenshot looks very different to the standard WP admin. Can you share a more complete screenshot that helps explain what all these tabs are? |
@elliotcondon The look of the WP admin is not important here. This comes from my admin theme. I've figured out more about this issue. In my case I have older deprecated field groups. This field groups are loaded from a other location. I load the default field groups from "acf-json" and the deprecated field groups from a additional folder "acf-deprecated-json". Some of this deprecated field groups includes a clone field, which is embed a other deprecated field group. It's possible that this deprecated field groups lose the connection to the included clone field? Do you have any idea how we can solve this specific case? |
@elliotcondon Now I could solve this issue, after deleting all field groups from the ACF field groups page and importing all field groups from JSON files again. Now everything works fine. It seems there was some field groups, which was not up to date. |
After updating from 5.7.10 to 5.8.0, I get the following notices:
Notice: Undefined index: key in /plugins/advanced-custom-fields-pro/includes/acf-field-functions.php on line 349
Notice: Undefined index: ID in /plugins/advanced-custom-fields-pro/includes/acf-field-functions.php on line 361
This is usually not a problem, but when trying to use with other plugins like https://www.wpgraphql.com/acf
It causes an issue where my graphql endpoint breaks because of this function.
ACF Pro version: 5.8.0
PHP version: 7.1.20
ACF Implementation: Flexible content component using cloned ACF field groups as layouts.
This issue has already been reported in the support forums:
https://support.advancedcustomfields.com/forums/topic/acf-field-functions-php349-undefined-index-key/
And the solution for it has been posted but no PR was ever created.
The text was updated successfully, but these errors were encountered: