Blog posts related to PHP 7.

The Magical (Dis)appearing $this Psuedo-Variable

At the office, we recently upgraded our staging server to PHP 7.  For the most part, this caused no problems at all and worked very well (and faster!).  But our event pages were failing, just giving us a white screen.  I looked in the "Recent log messages," and saw this:  "Error: Using $this when not in object context."  The code that triggered this error was a non-static class method that was being called statically from within a different class.  In PHP 5, this code only gives a "Deprecated" notice that non-static classes should not be called statically.

Tags