ID:               33996
 Updated by:       [EMAIL PROTECTED]
 Reported By:      phpbugs at majiclab dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: Mac OSX 10.4
 PHP Version:      5.0.4
-Assigned To:      
+Assigned To:      dmitry
 New Comment:

Dmitry, could you plz look at it?
I can reproduce it with 5.1 too.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to