Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16280 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14466 invoked by uid 1010); 18 May 2005 16:40:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85660 invoked from network); 18 May 2005 16:18:10 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 18 May 2005 16:18:10 -0000 X-Host-Fingerprint: 64.233.184.192 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.192:15836] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id AC/54-01538-2CA6B824 for ; Wed, 18 May 2005 12:18:10 -0400 Received: by wproxy.gmail.com with SMTP id 57so204220wri for ; Wed, 18 May 2005 09:18:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gizr1/SDNCEL/tpMxTxC0pNYgsqbRxZ6fngHEKl9WJ1Ua46l7NVWXhPRPwERcMRCDaG1qOuY0jcsnfzyDqu1eXb1v1EHPMt0SRtX5yhzQI+YPCx8yMxwo+b9AmoQsx3MXIu6tAxeH7CtlnIC00rX6dCGxNVzB9cmAJq9xqxDhgY= Received: by 10.54.13.38 with SMTP id 38mr406009wrm; Wed, 18 May 2005 09:18:02 -0700 (PDT) Received: by 10.54.77.4 with HTTP; Wed, 18 May 2005 09:18:02 -0700 (PDT) Message-ID: <4e89b4260505180918bea381e@mail.gmail.com> Date: Wed, 18 May 2005 12:18:02 -0400 Reply-To: Wez Furlong To: Nicholas Telford Cc: Lukas Smith , internals@lists.php.net In-Reply-To: <428B636F.1050902@ntlworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050518132615.55570.qmail@lists.php.net> <428B40D7.8030903@php.net> <4e89b426050518083848d9a25@mail.gmail.com> <428B636F.1050902@ntlworld.com> Subject: Re: [PHP-DEV] Re: Allow PDO::query() to return a subclass of PDOStatement From: kingwez@gmail.com (Wez Furlong) parent::method() should work, but the point is that if you add a foo() method in a class that extends PDO, at a time where there is no PDO::foo(), and you make it work in a particular way, and 6-18 months later, when PDO::foo() gets added and does something totally different. Now, someone else is consuming your library and hasn't yet used your foo() implementation, they read the PDO manual and spot the official PDO::foo() method and wonder why it doesn't work right. Even more of a headache is that drivers can magically add methods to the namespace; different methods may be present on an instance (via call overloading) depending on which driver is in use. These are not visible via reflection. This is a classic namespacing problem. We've solved this internally be forcing drivers to prefix their methods with the driver name. Any non-prefixed method names are reserved for future use by PDO. If you don't follow this guideline, your code is officially broken :-) --Wez. On 5/18/05, Nicholas Telford wrote: > Wez Furlong wrote: >=20 > >Just like extending any other built-in class, you need to be careful > >to not override built-in methods that either exist now or may exist in > >the future; you can very easily burn yourself 6 months down the track > >this way. > > > >It's generally a bad idea, and definitely something to avoid if you > >are building a class library. > > > >You have now been warned that the traffic is dangerous; if you want to > >go play in it, it's your choice :-) > > > >--Wez. > > > > > The same could be said for using an external Framework or library > (except that they'd have the luxury of protecting important methods with > "final"). >=20 > I take it parent::method() works with built-in classes? >