sage-directives icon indicating copy to clipboard operation
sage-directives copied to clipboard

Fatal error: @image($id, 'size') causing syntax error from trailing parameter comma.

Open christianmagill opened this issue 4 years ago • 3 comments

When I use the @image directive like such...

@image($image, $image_size)

It generates the following code...

    <?php echo wp_get_attachment_image(
                $image,
                $image_size,
                false,
              
            ); ?>

This causes a fatal error on my server due to the trailing comma:

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: syntax error, unexpected ')'

christianmagill avatar Jun 05 '20 20:06 christianmagill

Yeah, that requires PHP 7.2 if I recall. My mistake.

Care to do a PR?

Log1x avatar Jun 05 '20 21:06 Log1x

I don't have much experience with creating directives, but I'll take a look.

christianmagill avatar Jun 08 '20 12:06 christianmagill

I ended up just upping my PHP version to fix the issue.

christianmagill avatar Jun 08 '20 13:06 christianmagill