ID: 41930
User updated by: andrea dot barani at tin dot it
Reported By: andrea dot barani at tin dot it
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows Vista (32bit)
PHP Version: 5.2.3
New Comment:
Ok, I was confused by the fact that most of the standard error messages
are in fact complete senteces. I thought the last words were part of the
message itself.
I apologize for the mistake. :)
Previous Comments:
------------------------------------------------------------------------
[2007-07-09 14:13:50] [EMAIL PROTECTED]
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);
------------------------------------------------------------------------
[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