From:             [EMAIL PROTECTED]
Operating system: Redhat 7.2
PHP version:      4.1.0
PHP Bug Type:     Unknown/Other Function
Bug description:  Extra null parameter appearing with func_get_args

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 bug report at http://bugs.php.net/?id=15555&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15555&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15555&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15555&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15555&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15555&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15555&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15555&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15555&r=submittedtwice

Reply via email to