Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45580 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89678 invoked from network); 16 Sep 2009 20:58:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2009 20:58:19 -0000 Authentication-Results: pb1.pair.com header.from=ctrahey@csisd.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ctrahey@csisd.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain csisd.org from 204.56.144.240 cause and error) X-PHP-List-Original-Sender: ctrahey@csisd.org X-Host-Fingerprint: 204.56.144.240 gateway.csisd.org Received: from [204.56.144.240] ([204.56.144.240:53342] helo=gateway.csisd.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/14-62393-A6151BA4 for ; Wed, 16 Sep 2009 16:58:19 -0400 Received: from gateway.csisd.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 92D37794359_AB15167B for ; Wed, 16 Sep 2009 20:58:15 +0000 (GMT) Received: from mail.csisd.org (email4400.csisd.org [204.56.144.241]) by gateway.csisd.org (Sophos Email Appliance) with ESMTP id 5724C79434C_AB15167F for ; Wed, 16 Sep 2009 20:58:15 +0000 (GMT) Message-ID: Date: Wed, 16 Sep 2009 15:59:16 -0500 X-Mailer: FirstClass 9.1 (build 9.221) X-FC-SERVER-TZ: 10486504 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="--=_--051f6c07.051f613f.c6d70224" Subject: reference caller object From: ctrahey@csisd.org ("Chris Trahey") ----=_--051f6c07.051f613f.c6d70224 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit (Please direct me elsewhere if necessary, this is a feature request) It would be handy to allow a method to behave differently based on who is calling it. the function I am looking for would essentially do this: function getCaller(){ $bt = debug_backtrace(); return $bt[2]['object']; } But of course, there is a lot of uneccessary processing with that call. Perhaps it could be implimented similar to "self" and "parent" (actualy more like "static") keywords. So you could do: public function registerMe() { if( ! (caller instanceof 'my_interface')) throw new dev_execption(); if( ! ($this->authenticateMod(caller))) throw new admin_exception('module not active'); $this->loadedMods[caller->module_id()] = caller; return caller->onLoad(); } Chris Trahey Web Applications Developer Database Administrator CSISD [Technology] ----=_--051f6c07.051f613f.c6d70224--