Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39683 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83261 invoked from network); 6 Aug 2008 04:24:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2008 04:24:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=davey@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=davey@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 207.97.245.223 as permitted sender) X-PHP-List-Original-Sender: davey@php.net X-Host-Fingerprint: 207.97.245.223 smtp223.iad.emailsrvr.com Linux 2.4/2.6 Received: from [207.97.245.223] ([207.97.245.223:57536] helo=smtp223.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/7E-01880-76729984 for ; Wed, 06 Aug 2008 00:24:07 -0400 Received: from relay12.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay12.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 049DE5B2E75; Wed, 6 Aug 2008 00:24:04 -0400 (EDT) Received: by relay12.relay.iad.mlsrvr.com (Authenticated sender: davey-AT-pixelated-dreams.com) with ESMTP id 9D7C95B2E72; Wed, 6 Aug 2008 00:24:03 -0400 (EDT) To: "Hannes Magnusson" In-Reply-To: <7f3ed2c30808040414y41f32ef6ka5a9396e027978d5@mail.gmail.com> References: <220AF877-747F-4BDB-8631-235B54ED2503@php.net> <7f3ed2c30808040049w7172205ey4ae460be4beabcee@mail.gmail.com> <1217847749.4175.27.camel@goldfinger.johannes.nop> <7f3ed2c30808040414y41f32ef6ka5a9396e027978d5@mail.gmail.com> Message-ID: <2A1FDF9D-4C69-433C-8187-6D3C8A1BA550@php.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v928.1) Date: Wed, 6 Aug 2008 00:24:02 -0400 Cc: =?ISO-8859-1?Q?=22Johannes_Schl=FCter=22?= , internals@lists.php.net X-Mailer: Apple Mail (2.928.1) Subject: Re: [PHP-DEV] [PATCH] Alias stream_context_get_default() as stream_context_set_default() From: davey@php.net (Davey Shafik) OK, here's an attempt at a patch[1], I discussed it briefly with =20 Johannes and he felt some discussion was needed with regards to the return value. I personally seem some benefit to returning the "new" context; Johannes wasn't sure that returning "true" might not be a better option in that =20= we cannot return the previous "value" like ini_set(). I had suggested a second optional argument that could be assigned the resource (context), and then return true. Though I still think that =20 returning the resource is the best option. - Davey [1] http://pixelated-dreams.com/~davey/stream_context_set_default.patch On Aug 4, 2008, at 07:14 AM, Hannes Magnusson wrote: > On Mon, Aug 4, 2008 at 13:02, Johannes Schl=FCter =20= > wrote: >> On Mon, 2008-08-04 at 09:49 +0200, Hannes Magnusson wrote: >>> On Mon, Aug 4, 2008 at 01:29, Davey Shafik wrote: >>>> Hey, >>>> >>>> it has come to my attention that stream_context_get_default() >>>> is /grossly/ misnamed, considering >> [...] >>> That doesn't really solve anything as the argument is optional. >> >> Adding a new function which enforces the parameter sounds way better >> then a simple alias. > > I agree. > >> >>> In >>> fact, to me it reads like the default context would be reset to >>> nothing. >> >> I hope not ... I'd expect it to return the current default context >> unchanged, else that function certainly should be replaced.... > > Read the example again: $ctx =3D stream_context_*set*_default(); = (using > the "new alias") :) > > using stream_context_*get*_default() without passing context to it > returns the default context. > > -Hannes