After the recent upgrade of php5.3 to php5.6.19, a number of deprecated functions have occurred, such as: Deprecated:preg_replace (): the/e modifier is Deprecated, using Preg_replace_ Callback instead. So we started to modify it and replace it with Preg_replace_callback.
Certainly know the usage beforehand, but this is not the point. Now the problem is: when I'm done (post the changed code),
/* replace special blocks by "{php}" */ $source_content = preg_replace_callback($search, function ($r) { $str = $this->_quote_replace($this->left_delimiter); $str .= 'php'; $str .= str_repeat("\n", substr_count($r[0], "\n")); $str .= $this->_quote_replace($this->right_delimiter); return $str; }, $source_content);
The result reported fatal error:using $this when the not in object context this error.
Here is the result of instantiating an object. The functions inside are also not static.
How to solve this problem?
The problem has been resolved, this involves PHP version, in the php5.4 above is no problem.
Reply content:
After the recent upgrade of php5.3 to php5.6.19, a number of deprecated functions have occurred, such as: Deprecated:preg_replace (): the/e modifier is Deprecated, using Preg_replace_ Callback instead. So we started to modify it and replace it with Preg_replace_callback.
Certainly know the usage beforehand, but this is not the point. Now the problem is: when I'm done (post the changed code),
/* replace special blocks by "{php}" */ $source_content = preg_replace_callback($search, function ($r) { $str = $this->_quote_replace($this->left_delimiter); $str .= 'php'; $str .= str_repeat("\n", substr_count($r[0], "\n")); $str .= $this->_quote_replace($this->right_delimiter); return $str; }, $source_content);
The result reported fatal error:using $this when the not in object context this error.
Here is the result of instantiating an object. The functions inside are also not static.
How to solve this problem?
The problem has been resolved, this involves PHP version, in the php5.4 above is no problem.