Function inside a snippet returns error 500 with MODX 2.8.1

Hi

This function run fine in MODX 2.7.1, but returns error 500 with MODX 2.8.1

if(!function_exists(‘before’)){
function before($this, $inthat){
return substr($inthat, 0, strpos($inthat, $this));
}
}

Why ?

What does your PHP error log have to say about the 500 error?

You can’t use $this as a parameter name. Just rename it to something else.

1 Like