php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27290 warning msg on missing function argument should mention file/line of caller too
Submitted: 2004-02-17 11:11 UTC Modified: 2004-09-13 12:41 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: hartmut@php.net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2004-02-17 (dev) OS:
Private report: No CVE-ID: None
 [2004-02-17 11:11 UTC] hartmut@php.net
Description:
------------
usually the location of the caller what you really want to know here,
especially if you are trying to track this down from not-so-recent messages in your error_log ...

Reproduce code:
---------------
<?php
function foo($bar) {
}
foo();
?>

Expected result:
----------------
Warning: Missing argument 1 for foo() in foo.php on line 2, called in foo.php on line 4

Actual result:
--------------
Warning: Missing argument 1 for foo() in - on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-03 19:09 UTC] sean at acidreign dot net
over the last few days, I've had to tack down dozens of errors, with out knowing the file/line they actually occur in.
reporting the line of the function declaration rather then the line of the offending expression is completely useless. It makes tracking bugs extremely difficult, because it has to be done on a trial and error basis, looking for and testing every place a function is called.
 [2004-09-06 08:10 UTC] derick@php.net
Override your error handling function with set_error_handler() and use debug_print_backtrace(), or install Xdebug which automatically does the printing of backtraces for you (http://xdebug.org)
 [2004-09-06 08:46 UTC] hholzgra@php.net
Derick, while this would be the general way to solve this
i still believe that the "Missing argument" message should
tell the caller position by default, else the message us 
not really helpfull at all. 

This case is similar to "headers already sent" IMHO
and deserves an error message that helps to solve
the problem *without* additional error handling tweaks
 [2004-09-06 14:22 UTC] tony2001@php.net
Small patch (against HEAD) for ZE2 to fix the problem:
http://tony2001.phpclub.net/dev/tmp/bug27290.diff

 [2004-09-13 12:41 UTC] stas@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 11:01:28 2024 UTC