php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54448 Empty if block causes catch block to be skipped
Submitted: 2011-04-02 00:11 UTC Modified: 2013-10-10 03:54 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: mgfreshour at gmail dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.2.17 OS: CentOS
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: mgfreshour at gmail dot com
New email:
PHP Version: OS:

 

 [2011-04-02 00:11 UTC] mgfreshour at gmail dot com
Description:
------------
The test script will result in an "PHP Fatal error:  Uncaught exception 
'Exception'" with output of :
Start

Commenting out the if block will result in the expected output of :
Start
Inside
Finish

It seems the empty if block is nullifying the catch blocks.

Test script:
---------------
<?php
echo "Start\n";

try {
    try {
        throw new Exception("I'm dead");
        if (0) {
        }
    } catch (Exception $e) {
        echo "Inside\n";
    }
} catch (Exception $e) {
    echo "Outside\n";
}

echo "Finish\n";

Expected result:
----------------
Start
Inside
Finish

Actual result:
--------------
Start
PHP Fatal error:  Uncaught exception 'Exception'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-02 17:57 UTC] felipe@php.net
I can't reproduce this issue. Are you using any Zend extension?
 [2011-04-02 17:58 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2011-04-03 04:28 UTC] mgfreshour at gmail dot com
-Status: Feedback +Status: Open
 [2011-04-03 04:28 UTC] mgfreshour at gmail dot com
I have verified this behavior on two boxes.  The phpinfo are :
http://dl.dropbox.com/u/750344/mf-phpinfo.html
http://dl.dropbox.com/u/750344/dr-phpinfo.html

One has xdebug and eAccelerator and the other has just eAccelerator.  I'll create 
a VM without eAccelerator and attempt this again.  If the behavior doesn't 
continue, I'll submit the but to them.
 [2011-09-28 11:50 UTC] benoit dot chenu at gmail dot com
I've got the same problem on PHP 5.3.6 and also using eaccelerator 0.9.6.

This is a known bug of eaccelerator's optimizer. To currently solve the problem, 
disable it :

eaccelerator.optimizer="0"

I suppose that the bug can be closed.

ref : http://eaccelerator.net/ticket/317
 [2013-10-10 03:54 UTC] datibbaw@php.net
-Status: Open +Status: Not a bug
 [2013-10-10 03:54 UTC] datibbaw@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 15:01:29 2024 UTC