Robbo
Well-known member
I have been using a custom autoloader for certain tasks a hacky way and only just noticed the setInstance method which I should have been using all along. But then I don't know how...
getInstance is final and uses new self(); This means whenever calling it it is always giving an instance of XenForo_Autoloader due to supporting PHP 5.2 (could be resolved with 5.3 by simply doing new static();). So then I thought okay I'll just make my instance the old fashioned way, but again no because the constructor is protected (as it should be I guess). So the setInstance method simply doesn't work because you can't create a new instance. Unless I am missing something? I can hack it and do a getNewInstance() and then inject that but that shouldn't be needed?
getInstance is final and uses new self(); This means whenever calling it it is always giving an instance of XenForo_Autoloader due to supporting PHP 5.2 (could be resolved with 5.3 by simply doing new static();). So then I thought okay I'll just make my instance the old fashioned way, but again no because the constructor is protected (as it should be I guess). So the setInstance method simply doesn't work because you can't create a new instance. Unless I am missing something? I can hack it and do a getNewInstance() and then inject that but that shouldn't be needed?