Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fatal error: Using $this when not in object context in \lib\Preprocessor.php(40) : eval()'d code on line 1 #1
Ok, I cannot get this to work. I'm trying to override a static class as described in the documenation:
But I only get:
I'm on php 5.3.1
I'm afraid I won't be able to identify the problem without more context. For example, if it's a static class you're trying to override, then why does it have a __toString() method? Also, at what point exactly does the error occur? Is it thrown during redefinition, or only when the redefined method is called?
It would be ideal to see the source of the static class in question, but if that's impossible, answering the above questions should also shed some light on this issue.
I'm not trying to override a tostring method. Actually I try to override a method of joomla's JFactory class.
Here is a small part of the class:
Normally you call the method with JFactory::getMailer(). So I tried to override it with:
I'll have to trace when the error occurs, but I think that it is at redefinition time.
And as for the question, Patchwork was designed with development/testing environments in mind. Consequently, issues like performance and possible security concerns weren't taken that seriously. This doesn't necessarily mean that it will make your site unbearably slow and vulnerable, but there are absolutely no guarantees about that. The performance hit may vary wildly from site to site, so it's recommended that you measure it yourself. As for security, no actual concerns come to my mind, but given the terribly hackish preprocessing mechanism in Patchwork, you may never know.
So, while you can definitely use Patchwork wherever you want, I wouldn't really recommend using it in production.