[PHP-BUG] Bug #71274 [NEW]: func_get_args() behaviour change in PHP 7

[email protected] ("[email protected]")
Newsgroups php.standards
Message-ID <[email protected]>
From:             patrickallaert
Operating system: 
PHP version:      7.0.1
Package:          PHP Language Specification
Bug Type:         Bug
Bug description:func_get_args() behaviour change in PHP 7

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 bug report at https://bugs.php.net/bug.php?id=71274&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71274&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71274&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71274&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71274&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71274&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71274&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71274&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71274&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71274&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71274&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71274&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71274&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71274&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71274&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71274&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71274&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71274&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71274&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71274&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71274&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.