#31578 [NEW]: Type hinting fata error
| From: | mgkimsal at conduit dot com | Date: | Mon, 17 Jan 2005 01:25:20 +0000 |
| Subject: | #31578 [NEW]: Type hinting fata error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-72272@lists.php.net to get a copy of this message | ||
From: mgkimsal at conduit dot com
Operating system: all
PHP version: 5.0.2
PHP Bug Type: *General Issues
Bug description: Type hinting fata error
Description:
------------
http://us3.php.net/manual/en/language.oop5.typehinting.php
states that "Failing to satisfy the type hint results in a
fatal error."
This seems relatively useless compared to having PHP5
throw an exception. This would make it a recoverable
situation that could be handled gracefully rather than yet
another fatal error which PHP can't deal with.
http://bugs.php.net/bug.php?id=28001&edit=2
had a response
from Derick stating that someone should just write their
own custom error handler to catch this and deal with it,
but it's a fatal error - my php5.0.2 can not catch fatal
errors, and I'm not seeing anything in the docs that says
we should be able to handle fatal errors with user-defined
code.
I *DID* see an example file that caught a FATAL error
*when it was invoked by trigger_error()* but it doesn't
work in the code below.
Reproduce code:
---------------
<?php
set_error_handler("myfunc");
error_reporting(E_ALL);
function myfunc($errno, $errstr, $errfile, $errline) {
echo "err=$errono";
print_r(debug_backtrace());
}
class bar { }
class foo {
function me(bar $b) {
print_r($b);
}
}
$b = new bar;
$f = new foo();
$f->me("fff");
?>
Expected result:
----------------
I would expect a backtrace() dump on the screen.
Actual result:
--------------
PHP Fatal error: Argument 1 must be an object of class
bar in /var/www/html/v5/er.php on line 12
Fatal error: Argument 1 must be an object of class bar
in /var/www/html/v5/er.php on line 12
--
Edit bug report at http://bugs.php.net/?id=31578&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31578&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31578&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31578&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31578&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31578&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31578&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31578&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31578&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31578&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31578&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31578&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31578&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31578&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31578&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31578&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31578&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31578&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31578&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31578&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31578&r=mysqlcfg