Some discarded functions, such as Deprecated: preg_replace (): Theemodifierisdeprecated and usepreg_replace_callbackinstead, appeared after php5.3 was upgraded to php5.6.19 recently. So I started to modify it and replaced it with preg_replace_callback... some discarded functions, such as Deprecated: preg_replace (): The/e modifier is deprecated and use preg_replace_callback instead, appear after php5.3 is upgraded to php5.6.19 recently. So we started to modify it and replaced it with preg_replace_callback.
Of course, I want to know its usage in advance, but this is not the focus. The problem that arises now is: After I modify the code (post the modified 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);
Fatal error: Using $ this when not in object context is returned.
Here is the result of instantiating an object. The functions are not static either.
How can this problem be solved?
The problem has been solved. If php version is involved, it will be okay in php5.4 or above.
Reply content:
Some discarded functions, such as Deprecated: preg_replace (): The/e modifier is deprecated and use preg_replace_callback instead, appear after php5.3 is upgraded to php5.6.19 recently. So we started to modify it and replaced it with preg_replace_callback.
Of course, I want to know its usage in advance, but this is not the focus. The problem that arises now is: After I modify the code (post the modified 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);
Fatal error: Using $ this when not in object context is returned.
Here is the result of instantiating an object. The functions are not static either.
How can this problem be solved?
The problem has been solved. If php version is involved, it will be okay in php5.4 or above.