#33996 [Asn]: No information given for fatal error on passing invalid value to typed argument
ID: 33996
Updated by: dmitry@php.net
Reported By: phpbugs at majiclab dot com
Status: Assigned
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS-2005-08-4
Assigned To: dmitry
New Comment:
I think this is not a BUG and it shouldn't be fixed.
Previous Comments:
------------------------------------------------------------------------
[2005-08-04 22:50:26] sniper@php.net
Nevermind that. I get the same result. (I propably should have
eyeglasses or something :)
------------------------------------------------------------------------
[2005-08-04 22:20:17] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
I can NOT reproduce this with latest CVS..
------------------------------------------------------------------------
[2005-08-04 19:46:03] tony2001@php.net
Dmitry, could you plz look at it?
I can reproduce it with 5.1 too.
------------------------------------------------------------------------
[2005-08-04 17:43:45] phpbugs at majiclab dot com
Description:
------------
When passing an invalid value as a typed argument (as in !
($argument instanceof typedclass)), a Fatal Error is given,
with the following information:
Fatal error: Argument 1 must be an object of class Foo in
index.php on line 7
The problem is line 7 is the declaration of the function, not
the line of code that called the function. It makes bug
tracing on a big project next to impossible! Even using ZDE
Professional has the same results: I cannot find the function
that caused the error (and since the error is fatal, there is
no more stack for me to look at). The same goes for missing
arguments.
Reproduce code:
---------------
<?php
class Foo
{
// nothing
}
function FooTest(Foo $foo)
{
echo "Hello!";
}
function NormalTest($a)
{
echo "Hi!";
}
NormalTest();
FooTest();
FooTest(new Foo());
?>
Expected result:
----------------
Warning: Missing argument 1 for NormalTest() in /.../index.php
on line 17
Hi!
Warning: Argument 1 must be an object of class Foo in /.../
index.php on line 18
Actual result:
--------------
Warning: Missing argument 1 for NormalTest() in /.../index.php
on line 12
Hi!
Fatal error: Argument 1 must be an object of class Foo
in /.../index.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33996&edit=1
Thread (7 messages)