Problem/Motivation

Generated 250 nodes with devel, turn on tracker module and go to /tracker

Error notices:

Notice: Undefined index: property in tracker_page() (line 132 of core/modules/tracker/tracker.pages.inc).
Warning: array_merge(): Argument #1 is not an array in tracker_page() (line 132 of core/modules/tracker/tracker.pages.inc)

.

The $last_activities_attributes variable is getting an empty array.
$last_activity_attributes = rdf_rdfa_attributes($last_activity_mapping, $node->last_activity);

Proposed resolution

Possibly check to if the property exists or that the array is not empty before trying to check and merge that 'property' key.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelpittet’s picture

Issue tags: +Novice
FileSize
1000 bytes

Here's a patch that works and is fairly fast. Let me know if that's the right approach or maybe it has to do something different higher up (like not use rdf until it's enabled...)?

mcrittenden’s picture

Status: Active » Needs review
dags’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that this is an issue and this patch fixes it.

Xano’s picture

Dries’s picture

This patch will eliminate the warning, but it also eliminates the array_merge. I believe this may cause incorrect results to be returned.

Xano’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
865 bytes

This patch doesn't prevent the merge, but just makes sure the array item required for the merge is created if it doesn't exist yet.

joelpittet’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Novice +Quick fix

Much better approach, thank you Xano and Dries.

Gave it a test and works like a charm.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Since we're getting a warning here we obviously have no tests for this code :)

joelpittet’s picture

I can't think of how to test this type of fix. Any suggestions?

joelpittet’s picture

This still exists as I ran into it again testing #1939092: Convert theme_mark() to Twig

joelpittet’s picture

Status: Needs work » Needs review
FileSize
1.12 KB

I should mention that #6 seems to no longer fix this issue.

Here's a re-roll that does, looks like both items being merged need to check for that missing property key.

alexpott’s picture

Surely you can just create a test that does what the issue summary says - create some nodes and go to /tracker

joelpittet’s picture

Oh duh! I thought it was something devel does but it just happens regardless. Thanks for the *surely* trigger @alexpott.

joelpittet’s picture

@alexpott there is already a test that does that but doesn't seem to fail. I tried tweaking it a bit but I'm not really sure what 'property' merging is used for, is that an RDF thing or something else?

Anyways it doesn't fail with the minimal code in testTrackerAll.

alexpott’s picture

Issue tags: -Needs tests
FileSize
785 bytes

Here's a test only patch :)

Status: Needs review » Needs work

The last submitted patch, 15: 2100369.15.test-only.patch, failed testing.

dawehner’s picture

We could also just work on getting #1941830: Convert tracker listings to a view in.

joelpittet’s picture

Assigned: Unassigned » scor

Thanks for the patch @alexpott you make this look easy:D

Now I wonder if we should maybe initialize those arrays in RDF now or use #11. Assigning to scor to see what he thinks.

scor’s picture

Title: Undefined index: property in tracker_page() » Don't support RDFa in tracker listings
Issue tags: +RDF code sprint

We added RDFa support to tracker listings back in 2009 because I thought search engines would pick up recent updated content (and its RDFa) from the tracker, but sitemaps are, to this day, the de facto mechanism that search engines use to keep their index up to date. So, in hindsight, I don't think it makes sense to support RDFa in the tracker page, since search engines will ultimately look for this RDFa data in the node / entity pages, which is were we have all our RDFa markup. This way we can also get rid of more custom code that doesn't use the regular code flow from the field formatters to generate the RDFa markup (same as what we're aiming for with #2226493: Apply formatters and widgets to Node base fields).

We'll tackle this issue in the RDF code sprint we have later today.

ashepherd’s picture

Status: Needs work » Needs review
FileSize
10.91 KB

Based on comment #19 this patch removes RDFa support in the tracker module and the related RDF module test.

scor’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, I couldn't find any other place where we had RDFa in the tracker module.

ashepherd’s picture

Assigned: scor » ashepherd
joelpittet’s picture

Great that fixes this! Thanks @ashepherd and @scor. 238 lines of code less!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense to just remove the support. Committed/pushed to 8.x, thanks!

  • Commit 4eeda37 on 8.x by catch:
    Issue #2100369 by joelpittet, ashepherd, alexpott, Xano: Don't support...

Status: Fixed » Closed (fixed)

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