Bug #17904: Missing argument for function line number report

From: Date: Fri, 21 Jun 2002 16:44:19 +0000
Subject: Bug #17904: Missing argument for function line number report
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11703@lists.php.net to get a copy of this message
From:             david@php.net
Operating system: Linux
PHP version:      4.2.1
PHP Bug Type:     Scripting Engine problem
Bug description:  Missing argument for function line number report

The warning "Missing argument X for function()" is reported on the line the
function is defined, not the line calling the function. Since a missing
argument is an error in the caller, not the callee, the error should be
reported at the caller's line number.

Reproducing script:

<?

function NormalFunction($var1, $var2) {
  echo "Normalfunction called with $var1, $var2\n";
}

class ABC {
  function ABC($var1, $var2) {
    echo "I was constructed with $var1, $var2\n";
  }

  function Test($var1, $var2) {
    echo "My test function was called with $var1, $var2\n";
  }
}

NormalFunction(3);                           

$myobj = new ABC(4);

$myobj->Test(5);
?>


<br>
<b>Warning</b>:  Missing argument 2 for normalfunction()
 in <b>/home/david/missingarg.php</b> on line <b>3</b><br>
Normalfunction called with 3, 
<br>
<b>Warning</b>:  Missing argument 2 for abc()
 in <b>/home/david/missingarg.php</b> on line <b>8</b><br>
I was constructed with 4, 
<br>
<b>Warning</b>:  Missing argument 2 for test()
 in <b>/home/david/missingarg.php</b> on line <b>12</b><br>
My test function was called with 5, 

-- 
Edit bug report at http://bugs.php.net/?id=17904&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=17904&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=17904&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=17904&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=17904&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17904&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=17904&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=17904&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=17904&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=17904&r=globals



Thread (3 messages)

« previous php.bugs (#11703) next »