OK, here's an attempt at a patch[1], I discussed it briefly with 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 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 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üter <[EMAIL PROTECTED]> wrote:
On Mon, 2008-08-04 at 09:49 +0200, Hannes Magnusson wrote:
On Mon, Aug 4, 2008 at 01:29, Davey Shafik <[EMAIL PROTECTED]> 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 = stream_context_*set*_default(); (using
the "new alias") :)

using stream_context_*get*_default() without passing context to it
returns the default context.

-Hannes


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to