our client using NGINX with php 7.0.33-1. after deployed automad to NGINX I got 502 Bad Gateway in pages (index.php) but dashboard is working. I debug automad code and see preg_replace_callback
make automad not working on this server.
who also encounters errors like me?
also I test this code on server and get same 502.
<?php
$str = "<@ snippets/header.php @>
<@ snippets/videoj.php @>
<@ snippets/thebook.php @>
<@ snippets/theicons.php @>
<@ snippets/the-author.php @>
<@ snippets/thc-reviews.php @>
<@ snippets/thc-press.php @>
<section class=\"thc-davos\">
<div class=\"container\">
<div class=\"row\">
<@# with '/davos' @>
<@ snippets/has-popup.php @>
<@# end @>
</div>
</div>
</section>
<section class=\"thc-video-playlist\">
<div class=\"container\">
<div class=\"row\">
<@ set { %listKeys: 'PL5WW3f45kHqiBy8uCEWuvaG7XWY9Rm3t-', %namePlaylist: 'Gathering of Minds Interviews' } @>
<@ snippets/videoplaylist.php @>
</div>
</div>
</section>
<@ snippets/videosLibs.php @>
<@ snippets/footer.php @>";
$reg = "((?P<var>(@\{\s*([%:\?\w\.\-]+)\s*((?:\|(\s*([\w][\w\-]*)\s*(?:\((\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-7))\s*(?:,\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-8))\s*)*?)?\)\s*)?|\s*([\+\-\*\/])\s*(\d+(?:\.\d+)?|(?-10))\s*))*)\}))|\<@\s*(?:(?P<file>[\w\/\-\.]+\.[a-z0-9]{2,5})|(?P<call>[\w\/\-]+)\s*(?P<callOptions>\{.*?\})?|#\s*snippet\s+(?P<snippet>[\w\-]+)\s*@\>(?P<snippetSnippet>.*?)\<@#\s*end|#\s*with\s+(?P<with>"[^"]*"|'[^']*'|(@\{\s*([%:\?\w\.\-]+)\s*((?:\|(\s*([\w][\w\-]*)\s*(?:\((\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-7))\s*(?:,\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-8))\s*)*?)?\)\s*)?|\s*([\+\-\*\/])\s*(\d+(?:\.\d+)?|(?-10))\s*))*)\})|prev|next)\s*(?P<withOptions>\{.*?\})?\s*@\>(?P<withSnippet>.*?)(?:\<@#\s*else\s*@\>(?P<withElseSnippet>.*?))?\<@#\s*end|#\s*for\s+(?P<forStart>(@\{\s*([%:\?\w\.\-]+)\s*((?:\|(\s*([\w][\w\-]*)\s*(?:\((\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-7))\s*(?:,\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-8))\s*)*?)?\)\s*)?|\s*([\+\-\*\/])\s*(\d+(?:\.\d+)?|(?-10))\s*))*)\})|\d+(?:\.\d+)?)\s+to\s+(?P<forEnd>(@\{\s*([%:\?\w\.\-]+)\s*((?:\|(\s*([\w][\w\-]*)\s*(?:\((\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-7))\s*(?:,\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-8))\s*)*?)?\)\s*)?|\s*([\+\-\*\/])\s*(\d+(?:\.\d+)?|(?-10))\s*))*)\})|\d+(?:\.\d+)?)\s*@\>(?P<forSnippet>.*?)\<@#\s*end|#\s*foreach\s+in\s+(?P<foreach>pagelist|filters|tags|filelist|"[^"]*"|'[^']*'|(@\{\s*([%:\?\w\.\-]+)\s*((?:\|(\s*([\w][\w\-]*)\s*(?:\((\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+(?:\.\d+)?|(?-7))\s*(?:,\s*("(?:[^"\\]|\\.)*+"|'(?:[^'\\]|\\.)*+'|\w+|\d+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nippet>.*?)(?:\<@#\s*else\s*@\>(?P<ifElseSnippet>.*?))?\<@#\s*end)\s*@\>)";
$a = preg_replace_callback('/'.$reg.'/is', function($m){
print_r($m);
}, $str);
echo $a;