title: ReflectionException "Cannot access non-public member", but property is accessible?
body: <p>I'm changing the accessible flag of my reflection class, this way:</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>protected function getBaseSubscriptionPeriodReflection()
  {
      $reflection = new \ReflectionClass('Me\Project\Class');
  
      // Make all private and protected properties accessible
      $this-&gt;changeAccessibility($reflection, true);
  
      return $reflection;
  }
  
  protected function changeAccessibility(\ReflectionClass $reflection, $accessible)
  {
      $properties = $reflection-&gt;getProperties(\ReflectionProperty::IS_PRIVATE
          | \ReflectionProperty::IS_PROTECTED);
  
      foreach($properties as $property) {
          $property-&gt;setAccessible($accessible);
      }
  }
  </code></pre>
  
  <p>But when I try to set <code>firstDate</code> property value, I'm getting the exception:</p>
  
  <blockquote>
    <p>ReflectionException : Cannot access non-public member
    Me\Project\Class::firstDate.</p>
  </blockquote>
  
  <p>Here is the source of the exception (<code>setValue()</code> method):</p>
  
  <pre class="lang-php prettyprint-override"><code>$reflection = $this-&gt;getBaseSubscriptionPeriodReflection();
  $this-&gt;getSubscriptionPeriod($reflection)
  
  protected function getSubscriptionPeriod(\ReflectionClass $reflection)
  {
      $period = $reflection-&gt;newInstance();
  
      // Reflection exception here
      $reflection-&gt;getProperty('firstDate')-&gt;setValue($period, 'foo');
  
      return $period;
  }
  </code></pre>