ID: 34120
Updated by: [EMAIL PROTECTED]
Reported By: ondrej at sury dot org
Status: Assigned
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS, 4CVS (2005-08-013)
Assigned To: dmitry
New Comment:
Right.
I think this shouldn't be fixed.
Previous Comments:
------------------------------------------------------------------------
[2005-08-25 21:54:45] csaba at alum dot mit dot edu
Note: Because this function depends on the current scope to determine
parameter details, it may only appear in the first argument to a
function. Thus
myfunc1 (myfunc2 (func_get_arg(1), 7)) OK
myfunc1 (myfunc2 (7, func_get_arg(0))) Error
myfunc1 (7+func_get_arg(0)+func_get_arg(1)) OK
myfunc2 (func_get_arg(0), func_get_arg(1)) Error
If you must pass this value of func_get_arg() not in the first
argument, assign the results to a variable, and pass the variable."
Csaba Gabor from Vienna
------------------------------------------------------------------------
[2005-08-15 23:08:45] [EMAIL PROTECTED]
Dmitry, this script should fail for all of those:
<?php
function doTitle($a = NULL, $b = NULL) {
print "doTitle: $a, $b\n";
}
function doHead() {
doTitle(func_num_args());
doTitle(func_get_arg(0));
doTitle(func_get_args());
}
doHead("1", "2");
------------------------------------------------------------------------
[2005-08-13 20:23:35] [EMAIL PROTECTED]
Manual says:
"Note: Because this function depends on the current scope to determine
parameter details, it cannot be used as a function parameter. If you
must pass this value, assign the results to a variable, and pass the
variable."
------------------------------------------------------------------------
[2005-08-13 14:38:51] [EMAIL PROTECTED]
Well, that's true then. But I'm not sure how important this bug is :)
------------------------------------------------------------------------
[2005-08-13 14:37:03] ondrej at sury dot org
Hi Derrick,
I don't consider to be bug, that it cannot be used as function
argument.
However I consider to be bug, that it CAN be used if you use it only
once.
This works:
doTitle(func_get_arg(0));
This works also:
doTitle(func_get_arg(1));
So it should not work at all, to be consistent.
Ondrej.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/34120
--
Edit this bug report at http://bugs.php.net/?id=34120&edit=1