According to the comment, the max-age key will be array type. It results operation for cache age fails.

The fatal message looks like:

The website encountered an unexpected error. Please try again later.
Error: Unsupported operand types in Drupal\Core\Render\RenderCache->maxAgeToExpire() (line 284 of core/lib/Drupal/Core/Render/RenderCache.php).

Comments

johnhuang0808 created an issue. See original summary.

johnhuang0808’s picture

I tried to use NestedArray::mergeDeep() to fix the issue. It differs with array_merge_recursive(). Because it doesn't merge the values that are not arrays.

Quote from the description for NestedArray::mergeDeep():

This function is similar to PHP's array_merge_recursive() function, but it handles non-array values differently. When merging values that are not both arrays, the latter value replaces the former rather than merging with it.

This patch works for me.

johnhuang0808’s picture

Status: Active » Needs review
icurk’s picture

Status: Needs review » Reviewed & tested by the community

Patch works for me.

  • johnhuang0808 authored 50856d0 on 8.x-1.x
    Issue #2902184 by johnhuang0808, icurk: Invalid max-age value
    
boshtian’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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