Skip to content

Commit

Permalink
bug #3771 Fix function example in expression language component (raul…
Browse files Browse the repository at this point in the history
…fraile)

This PR was submitted for the master branch but it was merged into the 2.4 branch instead (closes #3771).

Discussion
----------

Fix function example in expression language component

The is_string check needs to be part of the runtime code, not of the compilation code, because it needs to check that the argument is a string, not the compiled code to access it (which is always a string as it is source code. cc @stof

Commits
-------

db710c4 Removed return statement
bc673f3 Fix function example in expression language component
  • Loading branch information
weaverryan committed Jul 11, 2014
2 parents a2ce937 + 235cf33 commit b32f9f2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions components/expression_language/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ This method has 3 arguments:
$language = new ExpressionLanguage();
$language->register('lowercase', function ($str) {
if (!is_string($str)) {
return $str;
}
return sprintf('strtolower(%s)', $str);
is_string(%1$s) ? strtolower(%1$s) : %1$s;
}, function ($arguments, $str) {
if (!is_string($str)) {
return $str;
Expand Down

0 comments on commit b32f9f2

Please sign in to comment.