Bug #65255 [Opn->Nab]: exception not catchable when thrown from autoload in an extended class
Edit report at https://bugs.php.net/bug.php?id=65255&edit=1
ID: 65255
Updated by: laruence@php.net
Reported by: ryan dot brothers at gmail dot com
Summary: exception not catchable when thrown from autoload in
an extended class
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.5.0
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
try the following example, you may found why this is expected:
<?php
function __autoload($class)
{
throw new Exception('abcd');
}
try
{
class test1 extends test2
{
public static function go()
{
}
}
test1::go();
}
catch (Exception $e)
{
echo 'caught';
exit;
}
Previous Comments:
------------------------------------------------------------------------
[2013-07-12 19:43:37] ryan dot brothers at gmail dot com
Description:
------------
This issue may be the same issue as bug 65254 that I just submitted. The following script throws a
Fatal Error rather than catching the exception.
Test script:
---------------
<?php
function __autoload($class)
{
throw new Exception('abcd');
}
class test1 extends test2
{
public static function go()
{
}
}
try
{
test1::go();
}
catch (Exception $e)
{
echo 'caught';
exit;
}
Expected result:
----------------
caught
Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message 'abcd' in
/tmp/test.php:4
Stack trace:
#0 /tmp/test.php(8): __autoload('test2')
#1 {main}
thrown in /tmp/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65255&edit=1
Thread (4 messages)