title: Warning: Attempt to assign property of non-object, but the Object exists
body: <p><strong>This is my class:</strong></p>
  
  <pre><code>class Network {
      protected $value = null;
      protected $properties = array();
      public $type = null;
  
      function __construct($value = null, $type = null) {
          $this-&gt;value = $value;
          $this-&gt;type = $type;
      }
  
      public function __set($name, $value) {
          if(isset($this-&gt;{$name})) {
              $this-&gt;{$name} = $value;
          } else {
              $this-&gt;properties[$name] = new self($value, null);
          }
      }
  
      public function __get($name) {
          return $this-&gt;properties[$name]-&gt;value;
      }
  
      public function __toString() {
          return $this-&gt;value;
      }
  }
  </code></pre>
  
  <p><strong>This is what I am trying to do:</strong></p>
  
  <pre><code>$networks = new \stdClass();
  $networks-&gt;test= new \Orange_Post\Network('Test');
  $networks-&gt;test-&gt;enabled = true;
  $networks-&gt;test-&gt;enabled-&gt;type = 'boolean';
  </code></pre>
  
  <p><strong>But I get the error:</strong></p>
  
  <blockquote>
    <p><strong>Warning:</strong> Attempt to assign property of non-object on the last line, $networks->test->enabled->type = 'boolean';</p>
  </blockquote>
  
  <p>This is my first attempt at branching out and doing something like this, and I just can't figure out what I am doing incorrectly.</p>