Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-21 Thread Lars Torben Wilson
2009/8/21 Hannes Magnusson :
> On Fri, Aug 21, 2009 at 13:06, Richard Quadling 
> wrote:
>> 2009/8/21 Greg Beaver :
>>> Lars Torben Wilson wrote:
 2009/8/20 Hannes Magnusson :

> In 2 years (when everyone knows about the warning) people will be
> wondering why the example shows a complicated way to throw an error..
>
> The example is nice to show what exactly no longer works, but the
> wording and example show a hint of disappointment that it doesn't work
> in 5.3..
>
> I don't know how to rephrase it though ;)
>
> Maybe add , including a file calling
> func_get_args() will throw an E_WARNING, even when included from
> functions.. ?
>
>
> -Hannes
>

 Hi Hannes, Greg, and others,

 I've been thinking about this some more and honestly, so far the
 wording I first posted still is the least ambiguous and most concise.
>
> Then go for it.
> If someone finds something better down the road then she will fix :)

OK. That tends to be my take on version-controlled sources too.

>>> I personally had no idea what it was talking about until I read the
>>> example, for what that's worth :).  I tend to find code far more
>
> Same here, as soon as I read the example I understood the issue

OK. Also, in that case, I'll keep thinking about the wording and hope
to come up with something clearer.

>> Regardless of how this is documented, isn't it a bug? The included
>> code _is_ in a function when it is executed, and therefore not in the
>> global scope.
>
> func_get/num_arg[s]() are not normal functions.

At first I considered it a bug as well but it has been flagged as
'wontfix' in http://bugs.php.net/bug.php?id=48569 since apparently the
old behaviour depended on "weird implementation of func_get_args()'.
There are arguments to be made both ways based on the current
documentation of include() and what, for instance, debug_backtrace()
returns. Perhaps more discussion is needed in php-internals on this
for a final resolution but as long as it's considered wontfix then it
should probably be documented in case someone else runs into it.

> -Hannes
>

Thanks for all the comments!

Torben


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-21 Thread Hannes Magnusson
On Fri, Aug 21, 2009 at 13:06, Richard Quadling wrote:
> 2009/8/21 Greg Beaver :
>> Lars Torben Wilson wrote:
>>> 2009/8/20 Hannes Magnusson :
>>>
 In 2 years (when everyone knows about the warning) people will be
 wondering why the example shows a complicated way to throw an error..

 The example is nice to show what exactly no longer works, but the
 wording and example show a hint of disappointment that it doesn't work
 in 5.3..

 I don't know how to rephrase it though ;)

 Maybe add , including a file calling
 func_get_args() will throw an E_WARNING, even when included from
 functions.. ?


 -Hannes

>>>
>>> Hi Hannes, Greg, and others,
>>>
>>> I've been thinking about this some more and honestly, so far the
>>> wording I first posted still is the least ambiguous and most concise.

Then go for it.
If someone finds something better down the road then she will fix :)



>>>
>> I personally had no idea what it was talking about until I read the
>> example, for what that's worth :).  I tend to find code far more

Same here, as soon as I read the example I understood the issue


> Regardless of how this is documented, isn't it a bug? The included
> code _is_ in a function when it is executed, and therefore not in the
> global scope.

func_get/num_arg[s]() are not normal functions.

-Hannes


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-21 Thread Richard Quadling
2009/8/21 Greg Beaver :
> Lars Torben Wilson wrote:
>> 2009/8/20 Hannes Magnusson :
>>
>>> In 2 years (when everyone knows about the warning) people will be
>>> wondering why the example shows a complicated way to throw an error..
>>>
>>> The example is nice to show what exactly no longer works, but the
>>> wording and example show a hint of disappointment that it doesn't work
>>> in 5.3..
>>>
>>> I don't know how to rephrase it though ;)
>>>
>>> Maybe add , including a file calling
>>> func_get_args() will throw an E_WARNING, even when included from
>>> functions.. ?
>>>
>>>
>>> -Hannes
>>>
>>
>> Hi Hannes, Greg, and others,
>>
>> I've been thinking about this some more and honestly, so far the
>> wording I first posted still is the least ambiguous and most concise.
>> I thought about Greg's idea some more, but that simply moves the
>> problem from one place to another.
>>
>> What about simply removing the example unless we get a lot of
>> complaints that the wording doesn't sufficiently explain it?
>> Personally I feel that a careful reading of the wording should cover
>> the issue well, and just included the example to be extra cautious.
>>
> I personally had no idea what it was talking about until I read the
> example, for what that's worth :).  I tend to find code far more
> explanatory than English for things of this nature.
>> On another note, would just a reading of the version note, without the
>> example added, sound disappointed? :) Honestly I'm not personally
>> disappointed about the change. I've never personally encountered that
>> usage before and probably would have considered it a little iffy if I
>> had.
>
> Greg
>

Regardless of how this is documented, isn't it a bug? The included
code _is_ in a function when it is executed, and therefore not in the
global scope.

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-21 Thread Greg Beaver
Lars Torben Wilson wrote:
> 2009/8/20 Hannes Magnusson :
>   
>> In 2 years (when everyone knows about the warning) people will be
>> wondering why the example shows a complicated way to throw an error..
>>
>> The example is nice to show what exactly no longer works, but the
>> wording and example show a hint of disappointment that it doesn't work
>> in 5.3..
>>
>> I don't know how to rephrase it though ;)
>>
>> Maybe add , including a file calling
>> func_get_args() will throw an E_WARNING, even when included from
>> functions.. ?
>>
>>
>> -Hannes
>> 
>
> Hi Hannes, Greg, and others,
>
> I've been thinking about this some more and honestly, so far the
> wording I first posted still is the least ambiguous and most concise.
> I thought about Greg's idea some more, but that simply moves the
> problem from one place to another.
>
> What about simply removing the example unless we get a lot of
> complaints that the wording doesn't sufficiently explain it?
> Personally I feel that a careful reading of the wording should cover
> the issue well, and just included the example to be extra cautious.
>   
I personally had no idea what it was talking about until I read the
example, for what that's worth :).  I tend to find code far more
explanatory than English for things of this nature.
> On another note, would just a reading of the version note, without the
> example added, sound disappointed? :) Honestly I'm not personally
> disappointed about the change. I've never personally encountered that
> usage before and probably would have considered it a little iffy if I
> had.

Greg


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-21 Thread Lars Torben Wilson
2009/8/20 Hannes Magnusson :
> In 2 years (when everyone knows about the warning) people will be
> wondering why the example shows a complicated way to throw an error..
>
> The example is nice to show what exactly no longer works, but the
> wording and example show a hint of disappointment that it doesn't work
> in 5.3..
>
> I don't know how to rephrase it though ;)
>
> Maybe add , including a file calling
> func_get_args() will throw an E_WARNING, even when included from
> functions.. ?
>
>
> -Hannes

Hi Hannes, Greg, and others,

I've been thinking about this some more and honestly, so far the
wording I first posted still is the least ambiguous and most concise.
I thought about Greg's idea some more, but that simply moves the
problem from one place to another.

What about simply removing the example unless we get a lot of
complaints that the wording doesn't sufficiently explain it?
Personally I feel that a careful reading of the wording should cover
the issue well, and just included the example to be extra cautious.

On another note, would just a reading of the version note, without the
example added, sound disappointed? :) Honestly I'm not personally
disappointed about the change. I've never personally encountered that
usage before and probably would have considered it a little iffy if I
had.


Regards,

Torben


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-20 Thread Lars Torben Wilson
2009/8/20 Hannes Magnusson :
> On Thu, Aug 20, 2009 at 08:13, Lars Torben Wilson wrote:
>> Hi all,
>>
>> Just asking because I've been out of the loop for a while (again) but
>> a coworker recently noticed this BC break in func_get_args() and
>> friends. While the changes to way func_get_args() do seem necessary
>> this should probably still be documented. I just wanted to make sure
>> I'm not breaking any current standards too badly with this. :)
>>
>> I've added similar notes and examples to func-get-arg.xml and
>> func-arg-num.xml but have left them out of this email for brevity.
>>
>> If I don't hear any objections I'll commit tomorrow. Or if I get an OK
>> tonight, I'll commit tonight. :)
>
>
> In 2 years (when everyone knows about the warning) people will be
> wondering why the example shows a complicated way to throw an error..

Hi Hannes,

I many ways I agree--but I'm not sure that in two years, everyone will
know about it. Honestly I can't say I am personally surprised by the
change; given the way PHP works I can see this being expected to
either A) work or B) not work. I've been using PHP since long before
func_get_args() was added and have never seen this construct used,
though--so I'm not sure how many examples of this kind of usage are
really out there in the wild.

Until someone else comes forward and says "WTF?" I'd be tempted to
treat this as an edge case.

> The example is nice to show what exactly no longer works, but the
> wording and example show a hint of disappointment that it doesn't work
> in 5.3..
>
> I don't know how to rephrase it though ;)

Neither do I. :) I've been rewriting it for two days trying to satisfy
myself. So far this is the best I've come up with that is unambiguous
and still explains the difference. I agree that perhaps the example is
overdoing it; I just didn't want to include too little info since that
tends to lead to chaos in the user notes. :)

Perhaps surprisingly the change should be fairly easy to work around
for people who need it to work.

> Maybe add , including a file calling
> func_get_args() will throw an E_WARNING, even when included from
> functions.. ?

I could see something like that. In fact at one point I had something
almost exactly like that but it didn't read all that well. I'll take
another pass at it after work today. It seemed that the changelog
section was appropriate though since it's version-related, but I also
thought about the errors list. I could go either way on that.

Mostly I think the change needs to be noted so when someone does run
into the change we can say it's documented, but I don't want to seem
disappointed at all in the change or drive it into the ground or
anything. I don't think it's exactly one of the bigger BC breaks
around but for a few folks it might be a surprise.

> -Hannes

Thanks for the notes!


Cheers,

Torben


Re: [PHP-DOC] Proposed patch to funchand docs

2009-08-20 Thread Hannes Magnusson
On Thu, Aug 20, 2009 at 08:13, Lars Torben Wilson wrote:
> Hi all,
>
> Just asking because I've been out of the loop for a while (again) but
> a coworker recently noticed this BC break in func_get_args() and
> friends. While the changes to way func_get_args() do seem necessary
> this should probably still be documented. I just wanted to make sure
> I'm not breaking any current standards too badly with this. :)
>
> I've added similar notes and examples to func-get-arg.xml and
> func-arg-num.xml but have left them out of this email for brevity.
>
> If I don't hear any objections I'll commit tomorrow. Or if I get an OK
> tonight, I'll commit tonight. :)


In 2 years (when everyone knows about the warning) people will be
wondering why the example shows a complicated way to throw an error..

The example is nice to show what exactly no longer works, but the
wording and example show a hint of disappointment that it doesn't work
in 5.3..

I don't know how to rephrase it though ;)

Maybe add , including a file calling
func_get_args() will throw an E_WARNING, even when included from
functions.. ?


-Hannes


[PHP-DOC] Proposed patch to funchand docs

2009-08-19 Thread Lars Torben Wilson
Hi all,

Just asking because I've been out of the loop for a while (again) but
a coworker recently noticed this BC break in func_get_args() and
friends. While the changes to way func_get_args() do seem necessary
this should probably still be documented. I just wanted to make sure
I'm not breaking any current standards too badly with this. :)

I've added similar notes and examples to func-get-arg.xml and
func-arg-num.xml but have left them out of this email for brevity.

If I don't hear any objections I'll commit tomorrow. Or if I get an OK
tonight, I'll commit tonight. :)

Comments/fixes of course are welcome.


Cheers,

Torben


Index: reference/funchand/functions/func-get-args.xml
===
--- reference/funchand/functions/func-get-args.xml  (revision 287473)
+++ reference/funchand/functions/func-get-args.xml  (working copy)
@@ -48,6 +48,15 @@
 This function can now be used in parameter lists.

   
+  
+   5.3.0
+   
+If this function is called from the outtermost scope of a file
+which has been included by calling include
+or require from within a function in the
+calling file, now generates a warning and returns &false;.
+   
+  
  
 

@@ -98,6 +107,53 @@
 

   
+  
+   
+func_get_args example before and
+after PHP 5.3
+
+
+
+
+ Output previous to PHP 5.3:
+
+
+
+
+
+ Output in PHP 5.3 and later:
+
+
+
+
+   
+