• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @alx359 ,
    the problem is not the escaped JSON string ’cause it is unescaped when read from advanced-cache.php (line 215).

    What file causes the error? advanced-cache.php:215?

    Paste here the real content of ttl_registry.php

    Thread Starter alx359

    (@alx359)

    Hi Salvatore,
    The only error I got for now is the one described in the first post.

    I lost the content of ttl_registry.php that produced the error during the tests, sorry.

    Looking some more at the code, I understand stripslashes in advanced-cache.php:215 should get rid of those escapes.

    It seems though wp-cloudflare-page-cache\libs\backend.class.php:1050 might be open for issues:

    $import_config = json_decode( trim($data['config_file']), true);

    As stripslashes is indeed applied before on line 1041 to $data, but by not being a recursive function it won’t be able to process $data['config_file'] if the latter is an array itself.

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @alx359 ,
    thank you! The plugin creates ttl_registry.php when a page is added into the fallback cache from advanced-cache.php

    Can you please reproduce the error and send us the code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘syntax error, unexpected ‘”‘ in ttl_registry.php on line 1’ is closed to new replies.