Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41373 invoked by uid 1010); 5 Apr 2004 08:02:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 41339 invoked from network); 5 Apr 2004 08:02:30 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 5 Apr 2004 08:02:30 -0000 Received: from [192.168.1.105] (pD95F8321.dip.t-dialin.net [217.95.131.33]) by shiva.mind.de (Postfix) with ESMTP id DEB7097B69; Mon, 5 Apr 2004 10:02:27 +0200 (CEST) Date: Mon, 5 Apr 2004 10:02:22 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1981266680593.20040405100222@marcus-boerger.de> To: Jochem Maas Cc: PHP internals In-Reply-To: <407066D8.50005@iamjochem.com> References: <407066D8.50005@iamjochem.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] protected __call() question From: helly@php.net (Marcus Boerger) Hello Jochem, using 'protected' for __call() hides that mechanism from the outside world, hence the behavior is correct. Just drop protected and it should work as you expect. marcus Sunday, April 4, 2004, 9:49:44 PM, you wrote: > the following code does not do what I expect, I made this test case > after a new version of PHP5 was put on the system I am developing > yesterday and some of my code no longer works: > Class CallMe > { > public function setup() > { > $this->fakeMethod(); > } > protected function __call($method, $params) > { > echo 'you called CallMe::'.$method."\n"; > } > } > echo <<< ___THEEND > EXPECTED RESULT: > ----------------------------------------- > you called CallMe::fakeMethod > ACTUAL RESULT: > ----------------------------------------- > ___THEEND; > $obj = new CallMe(); > $obj->setup(); ?>> > running the script on 'PHP 5.0.0RC2-dev (cli) (built: Apr 4 2004 > 13:07:13) (DEBUG)' gives me: > > EXPECTED RESULT: > ----------------------------------------- > you called CallMe::fakeMethod > ACTUAL RESULT: > ----------------------------------------- > PHP Fatal error: Call to protected method CallMe::__call() from context > '' in /var/www/santos/test/call.protected.php on line 7 > Fatal error: Call to protected method CallMe::__call() from context '' > in /var/www/santos/test/call.protected.php on line 7 > > Have I misunderstood the way PHP5 works? > Or maybe something is broken? does anyone else get an error? > I don't rule out that this could be something specific to the machine I > am on, unfortunately I am limited by knowledge and access in determining > if this is the case.