ID:               47714
 Comment by:       saschagros at gmail dot com
 Reported By:      crocodile2u at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Ubuntu 8.10
 PHP Version:      5.3.0beta1
 New Comment:

I can confirm this.

I am testing Drupal on PHP 5.3 and I am getting the same "Fatal error:
Exception
thrown without a stack frame in Unknown on line 0" in our
exception_handler test, because we creat a new object (to log
exceptions) in the exception handler function.


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

[2009-03-20 06:12:40] crocodile2u at gmail dot com

All the same with this snapshot. Both crashes remain.

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

[2009-03-20 00:56:24] fel...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



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

[2009-03-19 08:36:27] crocodile2u at gmail dot com

> The crash type depends on whether I use __autoload() or
> spl_autoload_register(). I the first case I get "Fatal error: 
> Exception
> thrown without a stack frame in Unknown on line 0", while in the 
> second
> I get "Fatal error: Allowed memory size of 134217728 bytes exhausted
> (tried to allocate 72 bytes) in /home/vbolshov/tmp/x.php on line 21
> Segmentation fault"

I am sorry but the error messages are mixed up here. 

Correct is:
for __autoload() - "Fatal error: Allowed memory size of 134217728 bytes
exhausted
(tried to allocate 72 bytes) in /home/vbolshov/tmp/x.php on line 21
Segmentation fault"
for spl_autoload_register(): "Fatal error: Exception
thrown without a stack frame in Unknown on line 0"

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

[2009-03-19 08:33:12] crocodile2u at gmail dot com

Description:
------------
When I use set_exception_handler() and attempt to create an instance of
a class inside the handler (the class is not yet loaded and needs to be
loaded with __autoload) - I get crashes.

The crash type depends on whether I use __autoload() or
spl_autoload_register(). I the first case I get "Fatal error: Exception
thrown without a stack frame in Unknown on line 0", while in the second
I get "Fatal error: Allowed memory size of 134217728 bytes exhausted
(tried to allocate 72 bytes) in /home/vbolshov/tmp/x.php on line 21
Segmentation fault"

It must be noticed, that in case the class already had been loaded by
the moment of the exception throw - there are no errors and everything
is ok.

I am terribly sorry the the reproduce code is longer than 20 lines but
it is really simple and I think it shows all the problems.

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

/*
Uncomment handler class declaration to get rid of crashes
*/

/*
class handler {
        function handle($e) {
                echo $e->getMessage()."\n";
        }
}
*/

function au($class) {
        eval('class handler {
                  function handle($e) {
                      echo $e->getMessage()."\n";
                  }
              }');
}

/*
Uncomment __autoload() and comment spl_autoload_register() call to
switch between crash types
*/

/*
function __autoload($class) {
        au($class);
}
*/

spl_autoload_register('au');

set_exception_handler(function($exception) {
        $h = new handler();
        $h->handle($exception);
});

throw new Exception('exception');

Expected result:
----------------
exception

Actual result:
--------------
In case we use spl_autoload_register:
--
Fatal error: Exception thrown without a stack frame in Unknown on line
0
--

In case we use __autoload:
--
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 72 bytes) in /home/vbolshov/tmp/x.php on line 21
Segmentation fault
--

Works ok when handler class declaration at the top is uncommented.


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


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

Reply via email to