Closed (fixed)
Project:
Schema.org Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Feb 2018 at 13:24 UTC
Updated:
4 Mar 2018 at 14:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
christophweber commentedFor what it's worth I am testing the D7 module on PHP 7.0.21 exclusively. No issues this far.
You're right, empty values aren't stripped, but if they don't stand for a required property Google doesn't mind and structured data validates fine. My previous JSON-LD solutions (with https://www.drupal.org/sandbox/nsciacca/2765653 still in production) don't strip empty values either and this never hurt us.
Comment #3
karens commentedI see no problems in 7.1, and tests pass for that as well. This causes tests against 7.0 to fail, but doesn't actually affect functionality or validation. So I'm inclined to not worry about this for release. It would help to identify the specific environment that fails because I can't replicate any problems locally so far, all I know is the test against 7.0 fails because of the extra empty values.
Comment #4
karens commentedFound the issue and did some general cleanup. It mostly affects deeply nested elements and in that situation it may involve more than just PHP 7. Here's a patch that seems to work, still testing. There's some cruft in the patch since I went ahead and did some general cleanup of SchemaMetatagManager as well. But the important part is the arrayTrim function which was not cleaning out empty values completely on deeply nested arrays. Which was made worse by the validation function that didn't work exactly right.
Comment #6
karens commented