NixNod Posted October 6, 2007 Share Posted October 6, 2007 Hey guys, I got one Strict Standards message in my application. I think, better than explain is show what is happening. I Got the following Class (Registry class) <?php class Registry { private $vars = array(); public function __set($varName, $varValue) { if (!isset($this->vars[$varName])) { $this->vars[$varName] = $varValue; } } public function __get($varName) { if (isset($this->vars[$varName])) { return $this->vars[$varName]; } } public function __unset($varName) { if (isset($this->vars[$varName])) { unset($this->vars[$varName]); } } public function __isset($varName) { return isset($this->vars[$varName]); } } ?> In some file (ex: index.php) I got the following piece of code: <?php ... $registry = new Registry; $registry->Mysql = new Mysql; // <<< LINE 27 ... ?> But I got the following message: Strict Standards: Creating default object from empty value in index.php on line 27 I know that I can change the error reporting thing, but I like my App running very well. Found it on PHP Bugs: http://bugs.php.net/bug.php?id=42852&edit=1 My PHP version is 5.2.3 running on Windows Someone knows what is happening? Thanks at all. Quote Link to comment https://forums.phpfreaks.com/topic/72047-solved-strict-standards-error/ Share on other sites More sharing options...
trq Posted October 6, 2007 Share Posted October 6, 2007 Where is your MySql class defined? Quote Link to comment https://forums.phpfreaks.com/topic/72047-solved-strict-standards-error/#findComment-363066 Share on other sites More sharing options...
NixNod Posted October 6, 2007 Author Share Posted October 6, 2007 It is required via __autoload() Quote Link to comment https://forums.phpfreaks.com/topic/72047-solved-strict-standards-error/#findComment-363069 Share on other sites More sharing options...
Rithiur Posted October 7, 2007 Share Posted October 7, 2007 Hmm. I run 5.2.4 on my Windows machine, and when I copypaste the exact code you are using (plus add simple "class Mysql { }", I do not get any errors. Perhaps the error is somewhere else, despite what PHP is claiming or there is some weird bug (Are you sure your autoloader is working?) Here's the code I used, which did not produce any errors for me: <?php error_reporting(E_ALL | E_STRICT); class Registry { private $vars = array(); public function __set($varName, $varValue) { if (!isset($this->vars[$varName])) { $this->vars[$varName] = $varValue; } } public function __get($varName) { if (isset($this->vars[$varName])) { return $this->vars[$varName]; } } public function __unset($varName) { if (isset($this->vars[$varName])) { unset($this->vars[$varName]); } } public function __isset($varName) { return isset($this->vars[$varName]); } } class Mysql { } $registry = new Registry; $registry->Mysql = new Mysql; ?> Quote Link to comment https://forums.phpfreaks.com/topic/72047-solved-strict-standards-error/#findComment-364180 Share on other sites More sharing options...
NixNod Posted October 8, 2007 Author Share Posted October 8, 2007 Sorry, by BIG MISTAKE. Registry var = $registry Var called = $register that print out an strict error. But thanks all comments Quote Link to comment https://forums.phpfreaks.com/topic/72047-solved-strict-standards-error/#findComment-364939 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.