KevinM1 Posted September 3, 2008 Share Posted September 3, 2008 I decided to download Google Chrome to see how it handled some light AJAX stuff. I decided to navigate to a small test script I wrote a while ago. It was working fine, and I haven't touched its source code in months. It's basically a test of the Front Controller in Zandstra's book with a tidbit of AJAX on top. Nothing particularly useful outside of a learning exercise for myself. In any event, I'm now getting the following error: Fatal error: Call to private MP_base_Registry::__construct() from context 'MP_base_RequestRegistry' in /home/nights/www/www/MP/base/RequestRegistry.php5 on line 8 The line in question is pretty innocent looking (for those who read through the coding style thread in the Polls section, this is my old coding style, which should illustrate how old this is): <?php class MP_base_RequestRegistry extends MP_base_Registry{ private static $instance; private $requests = array(); static function getInstance(){ if(!self::$instance){ self::$instance = new self(); // <-- line in question } return self::$instance; } protected function get($key){ return self::$instance->requests[$key]; } protected function set($key, $value){ self::$instance->requests[$key] = $value; } static function getRequest(){ return self::$instance->get('request'); } static function setRequest(MP_controller_Request $request){ self::$instance->set('request', $request); } } ?> And the base class, for poops and giggles: <?php abstract class MP_base_Registry{ private function __construct(){} abstract protected function get($key); abstract protected function set($key, $value); } ?> Looking over the news items my hosting company has sent out, it doesn't look like they changed anything on the backend that should effect this, and I never attempt to directly call the abstract registry class at all anywhere in these, or other, files. I'm a bit stumped. Quote Link to comment https://forums.phpfreaks.com/topic/122576-solved-odd-singleton-error/ Share on other sites More sharing options...
448191 Posted September 3, 2008 Share Posted September 3, 2008 Declare the constructor protected and the problem goes away. Quote Link to comment https://forums.phpfreaks.com/topic/122576-solved-odd-singleton-error/#findComment-632900 Share on other sites More sharing options...
KevinM1 Posted September 3, 2008 Author Share Posted September 3, 2008 Declare the constructor protected and the problem goes away. There we go...had to do the same with the session registry, too. I could've sworn it was working before, though. I wonder if the upgrade to 5.2.6 a couple months ago caused it to break (or, looking at it now, behave properly)? In any event, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/122576-solved-odd-singleton-error/#findComment-632906 Share on other sites More sharing options...
448191 Posted September 3, 2008 Share Posted September 3, 2008 It used to work on some previous version, can't recall in which one they fixed this bug. Quote Link to comment https://forums.phpfreaks.com/topic/122576-solved-odd-singleton-error/#findComment-632912 Share on other sites More sharing options...
KevinM1 Posted September 3, 2008 Author Share Posted September 3, 2008 It used to work on some previous version, can't recall in which one they fixed this bug. At least I know I'm not going crazy (well, with this, anyway). Quote Link to comment https://forums.phpfreaks.com/topic/122576-solved-odd-singleton-error/#findComment-632917 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.