php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17904 Missing argument for function line number report
Submitted: 2002-06-21 12:44 UTC Modified: 2002-06-26 05:42 UTC
Votes:3
Avg. Score:3.7 ± 1.2
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: david@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-06-21 12:44 UTC] david@php.net
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, 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-26 05:38 UTC] rairai82 at dev1 dot rairai82 dot com
Also a problem on php 4.06 on windows.  Same exact problem.  Definitely not a horrible problem, but annoying =].
 [2002-06-26 05:42 UTC] derick@php.net
Not really a bug, but expected behavior. Anyway, you can use xdebug.derickrethans.nl to get even more debug information, or wait for ZE2.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 20:01:34 2024 UTC