syntax error, unexpected ‘”‘ in ttl_registry.php on line 1
-
Got this entry in debug.log:
PHP Parse error: syntax error, unexpected '"' in /wp-content/wp-cloudflare-super-page-cache/domain.com/ttl_registry.php on line 1
After further investigation, noticed that the generated page
/wp-content/wp-cloudflare-super-page-cache/domain.com/ttl_registry.php
is containing a long JSON string populated this way:$swcfpc_ttl_registry='{\"my_page1.html\":0,\"my_page2.html\":0}';
Escaped quotes like
\"
aren’t a proper JSON syntax, according the JSON Validator, so to validate such string would need to be formatted like this instead:$swcfpc_ttl_registry='{"my_page1.html":0,"my_page2.html":0}';
To achieve that would need to modify
\plugins\wp-cloudflare-page-cache\libs\fallback_cache.class.php
line 69 from this:file_put_contents( $cache_path."ttl_registry.php", "<?php \$swcfpc_ttl_registry='".addslashes( json_encode($this->fallback_cache_ttl_registry) )."'; ?>");
to this:
file_put_contents( $cache_path."ttl_registry.php", "<?php \$swcfpc_ttl_registry='".json_encode($this->fallback_cache_ttl_registry)."'; ?>");
As this was a singular issue for now, I’m not sure if this is a bug, or there’s a reasoning behind such unorthodox escape.
- The topic ‘syntax error, unexpected ‘”‘ in ttl_registry.php on line 1’ is closed to new replies.