NO BUG: Incorrect output of PHP functions urlencode and rawurlencode

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

While using Bricks Builder’s echo function to output standard php functions urlencode and rawurlencode, the spaces are removed but they should be replaced by “+” or “%20” respectively.

For example, using {echo:rawurlencode(Hello World!)} outputs “HelloWorld%21”. It should be “Hello%20World%21”.

I also allowed these functions using Bricks’ filter in functions.php. Otherwise they don’t work.

add_filter( 'bricks/code/echo_function_names', function() {
  return [
    'rawurlencode',
    'urlencode',
  ];
} );

Hey @lustadesign,

make sure to wrap the argument in quotes as you would in “real PHP”:

{echo:rawurlencode('Hello World!')}

CleanShot 2024-08-21 at 15.10.40

Best,

André

Yep, this works. Thank you!