Fatal error: Using $this when not in object context

$this only makes sense in methods, not in functions

this is ok

class Foo {
     function bar() {
          $this->...

this is not

function some() {
    $this->

// edit: didn’t notice he passes “$this” as parameter

advice: simply replace “$this” with “$somethingElse”

Leave a Comment