php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47753 PHP crashes when in class method argument throw Exception
Submitted: 2009-03-23 13:44 UTC Modified: 2009-03-31 07:48 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: work at setor dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: work at setor dot net
New email:
PHP Version: OS:

 

 [2009-03-23 13:44 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-25 11:25 UTC] 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-31 07:48 UTC] jani@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 09 14:01:32 2024 UTC