#28714 [Com]: Type hint error completely useless
| From: | sean at acidreign dot net | Date: | Fri, 03 Sep 2004 17:13:13 +0000 |
| Subject: | #28714 [Com]: Type hint error completely useless | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65700@lists.php.net to get a copy of this message | ||
ID: 28714
Comment by: sean at acidreign dot net
Reported By: nlhowell at cableone dot net
Status: Open
Bug Type: Feature/Change Request
Operating System: WinXP Pro 2600 SP1
PHP Version: 5CVS-2004-06-09 (dev)
New Comment:
This bug is related to the one posted here:
http://bugs.php.net/bug.php?id=27290
Previous Comments:
------------------------------------------------------------------------
[2004-06-09 20:53:43] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28714&edit=1