php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71113 Undocumented behavior of func_get_arg(s)
Submitted: 2015-12-14 08:19 UTC Modified: 2015-12-17 09:46 UTC
From: kogleron at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.0.0 OS: OS X 10.11.1
Private report: No CVE-ID: None
 [2015-12-14 08:19 UTC] kogleron at gmail dot com
Description:
------------
Possibility to modify results from func_get_args() inside a function.

Test script:
---------------
<?php

function foo($params){

    print_r(['Before' => func_get_args()]);
    $params['from_foo1'] = 2;
    print_r(['After' => func_get_args()]);
}

foo(['from_global' => 1]);


Expected result:
----------------
Array
(
    [Before] => Array
        (
            [0] => Array
                (
                    [from_global] => 1
                )

        )

)
Array
(
    [After] => Array
        (
            [0] => Array
                (
                    [from_global] => 1
                )

        )

)

Actual result:
--------------
Array
(
    [Before] => Array
        (
            [0] => Array
                (
                    [from_global] => 1
                )

        )

)
Array
(
    [After] => Array
        (
            [0] => Array
                (
                    [from_global] => 1
                    [from_foo1] => 2
                )

        )

)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-14 09:11 UTC] laruence@php.net
-Package: *Programming Data Structures +Package: Documentation problem
 [2015-12-14 09:11 UTC] laruence@php.net
this has been documented in https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L190

maybe the document should be updated

thanks
 [2015-12-17 09:13 UTC] cmb@php.net
-Summary: Problems with func_get_args +Summary: Undocumented behavior of func_get_arg(s) -Assigned To: +Assigned To: cmb
 [2015-12-17 09:14 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2015-12-17 09:45 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=338280
Log: fixed #71113: Undocumented behavior of func_get_arg(s)
 [2015-12-17 09:46 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2015-12-17 09:46 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:07 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=674b07e333461d4cf961bdc075da7a455c42df8c
Log: fixed #71113: Undocumented behavior of func_get_arg(s)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC