AdvancedCustomFields / AdvancedCustomFields/acf

Cannot read property 'indexOf' of undefined when adding Google Map field on taxonomy

Open
#551 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

WordPress 5.8
ACF Pro 5.9.x or 5.10

As one of our customer reported a similar error on one of our plugins, it still have a javascript error with ACF when we add a Google Map field on taxonomy like post category for example.

Steps to reproduce

  1. Add an ACF field group with a Google Map field
  2. Add a rule to use this field on Forms/Taxonomy/Category(category)
  3. Go to Posts > Categories
  4. See the fatal javascript error which stucks the code execution behind the code in error

image

Why

It seems Google Map ajax request doesn't send any data property and so isn't defined while applying the indexOf method at https://github.com/AdvancedCustomFields/acf/blob/5.9.6/includes/forms/form-taxonomy.php#L301

There is also the same kind of error at https://github.com/AdvancedCustomFields/acf/blob/5.9.6/includes/forms/form-taxonomy.php#L306 because Google Map ajax request never returns responseText property.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with includes/forms/form-taxonomy.php around lines 301 and 306, then reproduce the Google Map field on a taxonomy category as described. Check the AJAX response handling when data and responseText are absent; done means the fatal JavaScript error no longer stops the taxonomy form.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.