php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #28714 Type hint error completely useless
Submitted: 2004-06-09 20:53 UTC Modified: 2006-04-03 12:45 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (20.0%)
From: nlhowell at cableone dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2004-06-09 (dev) OS: WinXP Pro 2600 SP1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nlhowell at cableone dot net
New email:
PHP Version: OS:

 

 [2004-06-09 20:53 UTC] nlhowell at cableone dot net
Description:
------------
When you have a type-hint error (ie: you pass an incompatible object to a function with a type hint), the error message is completely useless. It tells you where the function with the type hint is defined; it *should* tell you where you tried to pass the invalid object.

Logically, this makes sense. If I pass an object that doesn't fit the type hint, it's not the function that's at fault; it's mine.

Reproduce code:
---------------
<?php
class x
{
}
class y
{
}
function func(x $x)
{
return;
}
func(new y());
?>

Expected result:
----------------
Fatal error: Argument 1 must be an instance of x in c:\Inetpub\wwwroot\test.php5 on line 12

Actual result:
--------------
Fatal error: Argument 1 must be an instance of x in c:\Inetpub\wwwroot\test.php5 on line 8

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-03 19:13 UTC] sean at acidreign dot net
This bug is related to the one posted here:
http://bugs.php.net/bug.php?id=27290
 [2006-04-03 12:45 UTC] tony2001@php.net
Fixed long time ago.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC