php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62080 Vague/misleading example in call_user_func()
Submitted: 2012-05-20 18:58 UTC Modified: 2014-11-17 20:48 UTC
From: phplists at stanvassilev dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.13 OS: All
Private report: No CVE-ID: None
 [2012-05-20 18:58 UTC] phplists at stanvassilev dot com
Description:
------------
The doc page for call_user_func explains you can't pass arguments by reference 
(CORRECT) using it, and instead offers this line using call_user_func_array():

"call_user_func_array('increment', array(&$a)); // You can use this instead before 
PHP 5.3"

This comment "You can use this instead before PHP 5.3" is misleading and 
redundant. Nothing has changed in 5.3 regarding references in the arguments array. 
This is not call-time pass by reference, it's references in an array. This code 
work well in 5.2 & in 5.3, without errors/warnings.

This comment should be removed, the example is otherwise correct.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-01 10:33 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-02-01 10:33 UTC] krakjoe@php.net
This bug is reported for an unsupported version of PHP and is not connected to security.

It is therefore being closed.

If the bug is still present in a stable, supported version of PHP, please do open a new bug report.

Thanks for taking the time to help make PHP better :)
 [2014-02-01 13:29 UTC] salathe@php.net
-Status: Closed +Status: Re-Opened -Assigned To: krakjoe +Assigned To:
 [2014-02-01 13:29 UTC] salathe@php.net
The documentation could do with being improved, as mentioned in the original report.
 [2014-11-17 20:47 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=335189
Log: fixed comment in example of call_user_func with array (doc bug #62080)
 [2014-11-17 20:48 UTC] salathe@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: salathe
 [2014-11-17 20:48 UTC] salathe@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.

Fixed by removing "before PHP 5.3" from the comment (and putting it above the line of code for readability).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 05:01:30 2024 UTC