Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63059 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19744 invoked from network); 18 Sep 2012 13:07:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2012 13:07:18 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:51850] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/59-07072-50278505 for ; Tue, 18 Sep 2012 09:07:17 -0400 Received: from [192.168.2.230] (ppp-188-174-59-240.dynamic.mnet-online.de [188.174.59.240]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id B0B81634D1; Tue, 18 Sep 2012 15:07:13 +0200 (CEST) To: Rasmus Schultz Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Tue, 18 Sep 2012 15:07:13 +0200 Message-ID: <1347973633.5709.3055.camel@guyrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] constructor hook From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Tue, 2012-09-18 at 08:19 -0400, Rasmus Schultz wrote: > Hey, > > I'm going to make this brief, because I suspect a lot of people are going > to jump at the opportunity to cry bloody murder when I suggest this. > > I wonder if it would make sense to have a way to globally hook into > __construct() - sort of like how you can hook into the autoloaders with > spl_autoload_register() ... > > This could be useful for things like dependency injection and debugging. I don't think it's a good thing to have. "new" right now gives you a clear idea whats going on. Magic behind the scenes is hard to debug. If you really want it: https://github.com/johannes/php-test-helpers johannes