Skip to content

Commit

Permalink
check if function exists before including it in twig
Browse files Browse the repository at this point in the history
  • Loading branch information
menno-ll committed Nov 25, 2024
1 parent 0697141 commit 91dd89d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Twig_Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ public function getFunctions() {
$allowed_functions = apply_filters( 'clarkson_twig_functions', $this->functions );

foreach ( $allowed_functions as $function ) {
if ( ! function_exists( $function ) ) {
continue;
}

$twig_functions[] = new \Twig\TwigFunction( $function, $function );
}

Expand Down

0 comments on commit 91dd89d

Please sign in to comment.