FastCGI error from snippet-ops.php
-
Hi Shea!
First of all I’d like thank you for your awesome plugin.
For a while after using
code-snippets
instead of hackingfunctions.php
, i noticed this in my NGINX error logs:2019/06/11 01:54:54 [error] 8537#8537: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Invalid argument supplied for foreach() in /home/nginx/wordpress/wp-content/plugins/code-snippets/php/snippet-ops.php (361) : eval()'d code on line 5" while reading response header from upstream, client: 172.68.47.124, server: www.majlovesreg.one, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock :", host: "www.majlovesreg.one", referrer: "https://majlovesreg.one/"
I checked some of the posts in your forum and found out that this may be caused by one of the snippets. I’ve identified one snippet with a
foreach()
in line 5. I tested it but all seems good, and the pages where the code should be running looks okay. Here’s the snippet:function maj_code_tag($content) { $post_tags = get_the_tags(); $codecontent = $content; foreach( $post_tags as $tag) { if ( $tag->name === '{ code }' ) { ob_start(); echo do_shortcode( '[majprism]' ); $prepend = ob_get_contents(); ob_end_clean(); $append = '<p style="font-family: monospace; text-align: center;"><a href="/tag/code" style="color: #3c4858;"></></a></p>'; $codecontent = $prepend . $content . $append; } } return $codecontent; } add_filter('the_content', 'maj_code_tag');
All it does is format all my posts tagged with
{ code }
. It calls the shortcode[majprism]
that linksprism.js
andprism.css
to the page.All seems to work fine, but my OC-ness sometimes wants me to find the reason for, and then get rid of the error in
nginx
logs.Thanks for the help!
Here are samples of my posts with
{ code }
tag: https://www.majlovesreg.one/tag/code- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by . Reason: minor typo edit
The page I need help with: [log in to see the link]
- The topic ‘FastCGI error from snippet-ops.php’ is closed to new replies.