~franz/f-a.nz

ref: e52c0c035c5cd51a128c386bbceae82c1d1a3cd6 f-a.nz/_dev/2015/2015-04-09-expressionengine-php-error-non-static-method-should-not-be-called-statically.markdown -rw-r--r-- 1.4 KiB
e52c0c03 — Franz Geffke Commit local copy 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
layout: post
title:  "ExpressionEngine PHP Error: Non-static method should not be called statically"
date:   2015-04-09 08:00:00
excerpt: "Message: Non-static method Mx_calc::usage() should not be called statically, assuming $this from incompatible context"
categories: PHP
version: 2.9.2
packages: PHP
source: "https://support.ellislab.com/bugs/detail/20352/plugins-through-php-warning-with-strict-errors-on"
sourcetitle: "Plugins through PHP warning with strict errors on…. "
---

### Problem

    A PHP Error was encountered
    Severity: 8192
    Message: Non-static method Mx_calc::usage() should not be called statically, assuming $this from incompatible context
    Filename: mx_calc/pi.mx_calc.php
    Line Number: 20

and

    A PHP Error was encountered
    Severity: Warning
    Message: Cannot modify header information - headers already sent by (output started at PATH/system/codeigniter/system/core/Exceptions.php:170)
    Filename: core/Common.php
    Line Number: 479

### Solution

In this case, we need to modify Mx_calc, as stated in the error message:

1. Go to /system/expressionengine/third_party/mx_calc/pi.mx_calc.php
2. Look for **function usage()** around line 61
3. Replace it with **public static function usage()**

#### Before

    function usage()
    {
    ob_start();
    ?>

#### After

    public static function usage()
    {
    ob_start();
    ?>