This causes PHP warning and notices:
Warning: Missing argument 1 for taxonomy_autocomplete() in taxonomy_autocomplete() (line 79 of .../modules/taxonomy/taxonomy.pages.inc).
Notice: Undefined variable: field_name in taxonomy_autocomplete() (line 80 of .../modules/taxonomy/taxonomy.pages.inc).
Notice: Undefined variable: term_matches in taxonomy_autocomplete() (line 126 of .../modules/taxonomy/taxonomy.pages.inc).

Files: 
CommentFileSizeAuthor
#21 drupal-taxonomy-autocomplete-notices-combined-1242602-21.patch2.3 KBbabruix
PASSED: [[SimpleTest]]: [MySQL] 39,891 pass(es).
[ View ]
#16 drupal-taxonomy-autocomplete-notices-testonly-1242602-16.patch1.09 KBJvE
FAILED: [[SimpleTest]]: [MySQL] 36,996 pass(es), 0 fail(s), and 3 exception(s).
[ View ]
#16 drupal-taxonomy-autocomplete-notices-combined-1242602-16.patch2.43 KBJvE
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-taxonomy-autocomplete-notices-combined-1242602-16.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#10 1242602-fail-10.patch865 bytesswentel
FAILED: [[SimpleTest]]: [MySQL] 33,322 pass(es), 0 fail(s), and 3 exception(es).
[ View ]
#10 1242602-pass-10.patch2.04 KBswentel
PASSED: [[SimpleTest]]: [MySQL] 33,304 pass(es).
[ View ]
#2 1242602-2.patch856 bytesswentel
PASSED: [[SimpleTest]]: [MySQL] 32,924 pass(es).
[ View ]

Comments

sub

Status:Active» Needs review
StatusFileSize
new856 bytes
PASSED: [[SimpleTest]]: [MySQL] 32,924 pass(es).
[ View ]

Patch attached.

Is this still an issue in D8 after #93854: Allow autocompletion requests to include slashes has been fixed?

Swentel: The $matches array is never used, only $term_matches is - so you can simplify the code further by removing $matches..

You can see my patch in the more-or-less duplicate issue #665420: taxonomy autocomplete throws notice on non match

Title:Prevent taxonomy/autocomplete path from direct accessNotices in taxonomy_autocomplete()
Status:Needs review» Needs work
Issue tags:+Needs tests, +Novice

The patch here also needs to be rerolled for the core/ change at least, and we should add a test.

Tagging as novice for two tasks:

  • Reroll the patch and remove the unused $matches variable as suggested above. (See the patch in #665420: taxonomy autocomplete throws notice on non match.)
  • Add an automated test. (The test can probably be a simple matter of visiting the path and ensuring that there are no notices.) The test should fail when applied on its own, and pass when combined with the patch here. You can upload both the tests-only and combined patches in the issue to expose the test failure for reviewers.

Assigned:Unassigned» nanotube

I will take a stab at this, give me some time to figure out how to write the test for this.

@nanotube -- Are you still looking into this issue? If not we'll unassign it for someone else to take a crack at it. Thanks!

Assigned:nanotube» swentel

I'll take it this weekend.

Thanks swentel. Since this is your patch to begin with that make sense. In general though, could you give the assignee maybe a day or to two reply, just in case they're about to post something? (Especially for novice-tagged issues.) Thanks!

Status:Needs work» Needs review
StatusFileSize
new2.04 KB
PASSED: [[SimpleTest]]: [MySQL] 33,304 pass(es).
[ View ]
new865 bytes
FAILED: [[SimpleTest]]: [MySQL] 33,322 pass(es), 0 fail(s), and 3 exception(es).
[ View ]

Two patches, first one with test alone, this will fail. Second one with fix, should pass.

Status:Needs review» Needs work

We need to document the new optional variable:

* @param $field_name
*   The name of the term reference field.

Should be:

* @param $field_name
*   (optional) The name of the term reference field.

I'm not sure about that, since without a field_name this function simply does nothing. The patch simply makes sure no notices are triggered, let's get some more opinions on this.

Status:Needs work» Needs review

Yes, you're right.

I'm not sure about that, since without a field_name this function simply does nothing. The patch simply makes sure no notices are triggered, let's get some more opinions on this.

Hmm, good point. In that case we should document that fact in the parameter documentation, I think.

Thanks swentel! I got tied up. I thought the test result was supposed to be "[ ]", never got it to pass on my end.

Issue tags:-Needs tests
StatusFileSize
new2.43 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-taxonomy-autocomplete-notices-combined-1242602-16.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
new1.09 KB
FAILED: [[SimpleTest]]: [MySQL] 36,996 pass(es), 0 fail(s), and 3 exception(s).
[ View ]

Re-rolled for changes to tests in D8.
And to bump the issue.

Status:Needs review» Needs work
Issue tags:+needs backport to D6, +Novice, +needs backport to D7

The last submitted patch, drupal-taxonomy-autocomplete-notices-combined-1242602-16.patch, failed testing.

Version:8.x-dev» 7.x-dev
Assigned:swentel» Unassigned

This isn't relevant anymore for D8

Thanks @swentel! Backporting the patch from #16 for Drupal 7 would be a great novice task.

Edit: Instructions here.

Status:Needs work» Needs review
StatusFileSize
new2.3 KB
PASSED: [[SimpleTest]]: [MySQL] 39,891 pass(es).
[ View ]

Attached backport patch for D7.

Status:Needs review» Needs work
Issue tags:-needs backport to D6, -Novice, -needs backport to D7

The last submitted patch, drupal-taxonomy-autocomplete-notices-combined-1242602-21.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+needs backport to D6, +Novice, +needs backport to D7

Status:Needs review» Reviewed & tested by the community

Go with this! It's only a notice removal!

Status:Reviewed & tested by the community» Fixed

Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/054c8ab

This also has the "needs backport to D6" tag, so if someone wants to reopen it for backport please feel free. (However, it's my impression that non-security-related patches have not been committed to Drupal 6 for a long time.)

Automatically closed -- issue fixed for 2 weeks with no activity.