The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

__get() and __set() can be private, but not __call(). Why?

Maybe my brain just isn't working and there's some obvious explanation for this, but for now I'm bewildered.

When I test, I find that __get() and __set() will intercept member variable access even if they're private or protected, but when I try to make __call() private, I get an error message. The examples in the PHP manual seem to reflect this difference.

IIRC __get behaviour was changed in 5.1. In 5.0 only "missing" properties were forwarded to __get, as of 5.1 all "unresolvable" requests (undefs + access violations) are forwarded. __call seems still to use 5.0 semantics.