Bug->Doc #71274 [Dup->ReO]: func_get_args() behaviour change in PHP 7

From: Date: Tue, 05 Jan 2016 09:02:02 +0000
Subject: Bug->Doc #71274 [Dup->ReO]: func_get_args() behaviour change in PHP 7
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13065@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71274&edit=1 ID: 71274 Updated by: requinix@php.net Reported by: patrickallaert@php.net Summary: func_get_args() behaviour change in PHP 7 -Status: Duplicate +Status: Re-Opened -Type: Bug +Type: Documentation Problem Package: Scripting Engine problem PHP Version: 7.0.1 Block user comment: N Private report: N New Comment: The migration docs are basically the online version of the UPGRADING guides. But I don't see any mention of func_get_args() in them either. Previous Comments: ------------------------------------------------------------------------ [2016-01-05 08:17:56] patrickallaert@php.net Is the content of https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING visible somewhere on http://php.net/ ? I digged http://php.net/manual/en/migration70.php and filed this bug because I couldn't find anything, did I miss something? ------------------------------------------------------------------------ [2016-01-04 19:38:19] requinix@php.net The changes are intentional and the docs have already been updated (modified example and there's a note at the bottom). See also bug #71113. https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L190 http://svn.php.net/viewvc/phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml?r1=336598&r2=338280&pathrev=338280 ------------------------------------------------------------------------ [2016-01-04 13:58:02] patrickallaert@php.net Description: ------------ func_get_args() (and probably the related functions) are context sensitive in PHP 7.0 while it was not the case in PHP 5.x. If you change the content of one of your arguments and then call func_get_args(), the change you made is reflected in the results you get, even if those were scalars. See the results at: https://3v4l.org/Ti8YX Might be a doc issue if we consider that this behaviour is "normal" but it doesn't look documented and as per issue #30207, we previously emphasized that "func_get_args() returns the arguments *passed* to the function". Test script: --------------- <?php function issueWithArgs($x) { $x = 33; return func_get_args(); } var_dump(issueWithArgs(42)); Expected result: ---------------- array(1) { [0]=> int(42) } Actual result: -------------- array(1) { [0]=> int(33) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71274&edit=1

« previous php.doc.bugs (#13065) next »