Req #30211 [Opn->Csd]: Method argument type-mismatch returns error with method's line-number

From: Date: Tue, 15 Jul 2014 22:06:57 +0000
Subject: Req #30211 [Opn->Csd]: Method argument type-mismatch returns error with method's line-number
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186647@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=30211&edit=1 ID: 30211 Updated by: yohgaki@php.net Reported by: m dot leuffen at i-line dot net Summary: Method argument type-mismatch returns error with method's line-number -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues PHP Version: 5.0.1 -Assigned To: +Assigned To: yohgaki Block user comment: N Private report: N New Comment: http://3v4l.org/Wk3Ng hhvm has different results, but current PHP produces useful error message for this. Previous Comments: ------------------------------------------------------------------------ [2004-09-23 20:30:22] 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. ------------------------------------------------------------------------ [2004-09-23 16:55:49] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=30211&edit=1

« previous php.bugs (#186647) next »