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. </entry> </row> + <row> + <entry>5.3.0</entry> + <entry> + If this function is called from the outtermost scope of a file + which has been included by calling <function>include</function> + or <function>require</function> from within a function in the + calling file, now generates a warning and returns &false;. + </entry> + </row> </tbody> </tgroup> </informaltable> @@ -98,6 +107,53 @@ </screen> </example> </para> + <para> + <example> + <title><function>func_get_args</function> example before and + after PHP 5.3</title> + <programlisting role="php"> +<![CDATA[ +test.php +<?php +function foo() { + include './fga.inc'; +} + +foo('First arg', 'Second arg'); +?> + +fga.php +<?php + +$args = func_get_args(); +var_export($args); + +?> +]]> + </programlisting> + <para> + Output previous to PHP 5.3: + </para> + <screen> +<![CDATA[ +array ( + 0 => 'First arg', + 1 => 'Second arg', +) +]]> + </screen> + <para> + Output in PHP 5.3 and later: + </para> + <screen> +<![CDATA[ +Warning: func_get_args(): Called from the global scope - no function +context in /home/torben/Desktop/code/ml/fga.inc on line 3 +false +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="notes">