|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30211 Method argument type-mismatch returns error with method's line-number
Submitted: 2004-09-23 16:55 UTC Modified: 2014-07-15 22:06 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: m dot leuffen at i-line dot net Assigned: yohgaki (profile)
Status: Closed Package: *General Issues
PHP Version: 5.0.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
28 - 27 = ?
Subscribe to this entry?

 [2004-09-23 16:55 UTC] m dot leuffen at i-line dot net

if you define a ObjectType in Argument-List of a Method, the Line-Number (in Error-Message) points to the Method and not to the Line the argument is set.

This makes debugging very hard ;-)


Reproduce code:
01: <?PHP
02: class Test {
04:	public static function testmethod (Test $obj) {
05:	}
06: }
08: $string = "I'm a string";
09: Test::testmethod ($string);
10: ?>

Expected result:
Fatal error: Argument 1 must be an object of class Test in test.php on line 9

Actual result:
Fatal error: Argument 1 must be an object of class Test in test.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-23 20:30 UTC]
The line number is not wrong it is simply the method's line number instead of the caller's line number you expected. So this is a feature request.
 [2014-07-15 22:06 UTC]
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: yohgaki
 [2014-07-15 22:06 UTC]

hhvm has different results, but current PHP produces useful error message for this.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jan 27 04:05:54 2023 UTC