Search code examples
phpcachingtwigstoryblok

failed to open stream php error when loading stories from storyblok in twig


Currently I am using the silex boilerplate from the storyblok github repository, where I load the stories via the getStories function.

My code looks like this:

{% 
   set reference = getStories(global('references_path'), 1, 0, options('{"filter_by[customer_name]":"' ~ item.customer_name ~ '"}')) 
%}

This code is called from another twig component in a loop.

For one "reference" I do get this error message:

file_put_contents(../cache//c3RvcnlibG9rOnN0b3JpZXMvYTo0OntpOjA7czoxMDoiRXJkZ2FzIE/DliI7aToxO3M6MTE6ImRlL3Byb2pla3RlIjtpOjI7aToxO2k6MztzOjM6ImZzcCI7fQ==): failed to open stream: No such file or directory in /webapp/vendor/apix/cache/src/Files.php

Seems to be an Issue with the cache.

Thanks in advance.


Solution

  • The path which will be generated in your case contains a /. So PHP can't create the file because it would be in an not existing folder.

    We can see that this issue is in the Files.php of the Apix/Cache we are using to allow different caching options for the silex boilerplate. Nevertheless, we've found a way to fix this issue by now - but we will create a new pull request for the Apix/Cache so it will check for / before saving.

    For you this means:

    composer update
    

    to install our new php-client version v1.1.11.