ID:               41930
 Updated by:       [EMAIL PROTECTED]
 Reported By:      andrea dot barani at tin dot it
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows Vista (32bit)
 PHP Version:      5.2.3
 New Comment:

Your error handler is just incomplete, here's how it works:

<?php

function handler($errno, $errstr, $errfile, $errline)
{
    echo $errstr, " on line $errline in file $errfile";
}
set_error_handler('handler');

class Test1
{
    public function __construct(Test3 $variable)
    {
    }
}
class Test2
{
}

$test2 = new Test2;
$test1 = new Test1($test2);



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

[2007-07-08 23:56:07] andrea dot barani at tin dot it

Description:
------------
Error strings are trimmed out in custom error handlers for catchable
fatal errors.
This following code uses type hinting available in Php 5 to produce a
recoverable error. As you can see the last part of the error string is
missing.
This code has been tested under different conditions and paths, the
string is always trimmed after the word 'defined'.

Reproduce code:
---------------
<?php

function handler($errno, $errstr)
{
        echo $errstr;
}
set_error_handler('handler');

class Test1
{
        public function __construct(Test3 $variable)
        {
        }
}
class Test2
{
}

$test2 = new Test2;
$test1 = new Test1($test2);

?>

Expected result:
----------------
Argument 1 passed to Test1::__construct() must be an instance of Test3,
instance of Test2 given, called in D:\Web\test.php on line 20 and
defined in D:\Web\test.php on line 11

Actual result:
--------------
Argument 1 passed to Test1::__construct() must be an instance of Test3,
instance of Test2 given, called in D:\Web\test.php on line 20 and
defined


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41930&edit=1

Reply via email to