Bug #15555 Updated: Extra null parameter appearing with func_get_args

From: Date: Fri, 05 Jul 2002 19:19:07 +0000
Subject: Bug #15555 Updated: Extra null parameter appearing with func_get_args
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13259@lists.php.net to get a copy of this message
ID: 15555 Updated by: sniper@php.net Reported By: lindsay.marshall@ncl.ac.uk -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Redhat 7.2 PHP Version: 4.1.0 New Comment: Thank you for taking the time to report a problem with PHP. Unfortunately your are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. And if it still doesn't work with 4.2.1, please give us a short but complete example which shows clearly what the rproblem is. (complete script being one that can be easily copied/pasted and run in command line) Previous Comments: ------------------------------------------------------------------------ [2002-02-14 11:25:39] lindsay.marshall@ncl.ac.uk I have a function that takes a variable number of arguments and uses func_get_args to retrieve them as an array. In one place when I call this function with two arguments a third, empty argument is added. As the function is used to generate SQL 'where' clauses by joing strings with ' and ', this caused a sever problem to my system! I have added an explicit test for null strings in the function and this has worked round the problem. I use this function in many places in my code and only this one call has problems. Here is the function, you can see the work round code I added. function dband() { $args = func_get_args(); $str = jval(array_shift($args)); foreach ($args as $v) { # if ($v != '') # { $str .= ' and '.jval($v); # } } return $str; } I had another version of this function that tried to use array functions to achieve this result but I could not get it to work reliably, but for reasons other than extra arguments. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15555&edit=1

« previous php.bugs (#13259) next »