title: __call catches static method calls
body: <p>I'm using both the magic methods <a href="http://www.php.net/manual/en/language.oop5.overloading.php#object.call" rel="nofollow">_<em>call</a> and <a href="http://www.php.net/manual/en/language.oop5.overloading.php#object.callstatic" rel="nofollow"></em>_callStatic</a> for my own implementation of something like an ORM/Activerow. They're mainly meant for catching certain function calls:  <code>__call</code> is responsible for getters and setters, and <code>__callStatic</code> for <code>findBy</code> methods (e.g. <code>findById</code>).</p>
  
  <p>To map foreign keys, i'm trying to convert calls to e.g. <code>getArticle</code> to return the value of <code>Article::findById()</code>. To do that, i'm using this case inside my <code>__call</code>:</p>
  
  <pre><code>if (strstr($property, "_id")) {  
   return $foreignClass::findById($this-&gt;getId()); 
  }
  </code></pre>
  
  <p>where <code>$property</code> is the substring after <em>set</em> or <em>get</em> in <code>__call</code>, and <code>$foreignClass</code> the rest of the string. So, in the case of the call <code>getArticle</code>, $property would be get and <code>$foreignClass</code> would be <code>Article</code>.</p>
  
  <p>I've placed some echoes to ensure that the values are correct. However, my <code>__call</code> method gets called instead of my <code>__callStatic</code>. If i make an implicit static method <code>findById</code>, it does get called (so it does recognize it as a static call). If i specifically call <code>Article::findById()</code>, <code>__call</code> also catches it.</p>
  
  <p>Is this an error with the relatively new <code>__callStatic</code>, or am i doing something wrong?</p>
  
  <p>EDIT:
  The problem seems to reside in this part:</p>
  
  <blockquote>
    <p>_call() is triggered when invoking inaccessible methods in an object context.<br>
    __callStatic() is triggered when invoking inaccessible methods in a static context. </p>
  </blockquote>
  
  <p>Though i am calling it on a class, i am calling it from an object context. Is there a way to get into the static context in this case?</p>