#28714 [NEW]: Type hint error completely useless

From: Date: Wed, 09 Jun 2004 18:53:44 +0000
Subject: #28714 [NEW]: Type hint error completely useless
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-60671@lists.php.net to get a copy of this message
From: nlhowell at cableone dot net Operating system: WinXP Pro 2600 SP1 PHP version: 5CVS-2004-06-09 (dev) PHP Bug Type: Feature/Change Request Bug description: Type hint error completely useless 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 bug report at http://bugs.php.net/?id=28714&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28714&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28714&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28714&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28714&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28714&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28714&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28714&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28714&r=support Expected behavior: http://bugs.php.net/fix.php?id=28714&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28714&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28714&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28714&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28714&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28714&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28714&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28714&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28714&r=float

« previous php.bugs (#60671) next »