#47753 [Opn->Bgs]: PHP crashes when in class method argument throw Exception

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               47753
 Updated by:       [email protected]
 Reported By:      work at setor dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Reproducible crash
 Operating System: Linux
 PHP Version:      5.2.9
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.




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

[2009-03-25 11:25:51] berblinger at krumedia dot de

Guess this is - as you already mentioned - the same problem like the
bug #47730. 
If you rewrite the execute() function to something like this:
---------------

public function execute()
        {
                $tmp = $this->makeThrow();
                $this->test( $tmp );
        }

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

everything works fine. This segfault is only caused, when one of the
arguments of a valid function call throws an exception.

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

[2009-03-23 13:44:23] work at setor dot net

Description:
------------
Looks like this bug #47730

php chashes (Segmentation fault). See reproduce code and comments
inside for further details.


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

ini_set( 'display_errors', 1 );

class ExceptionBug
{
        public function execute()
        {
                $this->test( $this->makeThrow() );
        }

        private function test( $test )
        {
        }

        private function makeThrow()
        {
                throw new Exception( 'test' );
        }
}

$Test = new ExceptionBug();
$Test->execute();

Expected result:
----------------
Fatal error: Uncaught exception 'Exception' with message 'test' in
/data2/www/test.php:18 Stack trace: #0 /data2/www/test.php(9):
ExceptionBug->makeThrow() #1 /data2/www/test.php(23):
ExceptionBug->execute() #2 {main} thrown in /data2/www/test.php on line
18

Actual result:
--------------
nothing. php crashes.

Segmentation fault in cli


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


-- 
Edit this bug report at http://bugs.php.net/?id=47753&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.