php.net |  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
Votes:1
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: m dot leuffen at i-line dot net
New email:
PHP Version: OS:

 

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

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 ;-)

Bye,
  Matthias

Reproduce code:
---------------
01: <?PHP
02: class Test {
03:	
04:	public static function testmethod (Test $obj) {
05:	}
06: }
07:
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-23 20:30 UTC] helly@php.net
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] yohgaki@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: yohgaki
 [2014-07-15 22:06 UTC] yohgaki@php.net
http://3v4l.org/Wk3Ng

hhvm has different results, but current PHP produces useful error message for this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC