Notice: Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_SLASHES' in structured_data_preprocess_html() (line 62 of /xxx/sites/all/modules/structured_data/structured_data.module).

Warning: json_encode() expects parameter 2 to be long, string given in structured_data_preprocess_html() (line 62 of /xxx/sites/all/modules/structured_data/structured_data.module).

When installed

Comments

polyspiral created an issue. See original summary.

wayneloftus’s picture

StatusFileSize
new634 bytes

I am seeing the same issue.

As it turns out, the constant JSON_UNESCAPED_SLASHES is only available after PHP 5.4.0 http://php.net/manual/en/json.constants.php#constant.json-unescaped-slashes. You might check your PHP version. If you're like me, your architecture has you stuck at 5.3.3. Thanks Red Hat!

Removing it does make the urls look a bit odd (e.g., 'https:\/\/\drupal.org\/project\/structured_data'), but double-checking in Google's Structured Data Testing Tool, it interprets the escaped urls correctly: https://developers.google.com/structured-data/testing-tool/

Above is a patch which checks to see if the constant exists before using it.

wayneloftus’s picture

Status: Active » Needs review
wayneloftus’s picture

StatusFileSize
new636 bytes

Oops. Jumped the gun on that one and didn't quote the constant.

Fixed.

  • k_zoltan committed 9fc8128 on 7.x-1.x authored by wayneloftus
    Issue #2560483 by wayneloftus: Notice: Use of undefined constant...
k_zoltan’s picture

Status: Needs review » Fixed

Thanks for your contribution.
Pushed to dev.
Will be included in the next stable release.

Status: Fixed » Closed (fixed)

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