Ticket #242 (new defect)

Opened 4 years ago

Last modified 3 months ago

exceptions not catched

Reported by: jan1234 Owned by: hans
Priority: minor Milestone:
Component: Optimizer Version: 0.9.6
Keywords: exceptions Cc: cdri@…

Description

a thrown exception will not be catched, if a there is a user defined exception class. the following code:

<?php

Class MyException extends Exception {}

class A{
    static function b() {
        throw new Exception();
    }
}

try {
    A::b();
} catch (Exception $e) {
    echo 'test';
}

?>

gives:

Fatal error: Uncaught exception 'Exception' in
exceptions.php:7 Stack trace: #0 exceptions.php(12): A::b() #1 {main}
thrown in exceptions.php on line 7

when the eaccelerator chache is on.

version: eAccelerator 0.9.5 [shm:win32 sem:win32] PHP 5.2.1 [ZE 2.2.0] Using apache2handler on Windows NT 5.1 build 2600

Attachments

optimize.c#242.patch Download (481 bytes) - added by warwickshaw 3 years ago.
optimize.c_242.patch Download (481 bytes) - added by warwickshaw 3 years ago.

Change History

comment:1 Changed 3 years ago by bart

  • Owner changed from somebody to hans
  • Component changed from eAccelerator to Optimizer

This problem is caused by the optimizer, as a workaround you can disable the optimizer.

comment:2 Changed 3 years ago by k7k0

The Try/Catch? don't work at all, even with the native Exception class:

try {
    throw new Exception("No");
} catch (Exception $e) { 
    echo "Yes"; 
}

Fatal error: Uncaught exception 'Exception' with message 'No' in....

PHP 5.2.1-0.dotdeb.1 with Suhosin-Patch 0.9.6.2 (cli). Tested with version 0.9.5 and the latest snapshot at the time: svn301

comment:3 Changed 3 years ago by luke

  • Owner changed from hans to somebody
  • Priority changed from major to critical
  • Component changed from Optimizer to eAccelerator

This is a very important bug, that halts use of eAccelerator with every modern php5 app. Try/Catch? blocks don't work at all

try this:

try {

throw new Exception("No");

} catch (Exception $e) {

echo "Yes";

}

and it wont work. Config - default. php 5.2.2. Turning off optimizer doesn't change anything.

comment:4 Changed 3 years ago by JonathanO

  • Owner changed from somebody to hans
  • Component changed from eAccelerator to Optimizer

It works fine without the optimizer, so it's clearly an optimizer bug. Did you forget to reload Apache luke?

comment:5 Changed 3 years ago by luke

indeed i forgot to reload Apache :/.

sorry for this.

comment:6 Changed 3 years ago by cdribeta

  • Cc cdri@… added

Turn off Optimizer and clearing cache will correct this bug. Hope it'll be fixed soon :p

(trying to monitor this bug ... ?)

comment:7 Changed 3 years ago by Eri

Same with Apache on SEL with 5.2.3 :(

comment:8 Changed 3 years ago by hans

  • Status changed from new to assigned

Sorry, i'll look on it asap. Been very busy lately, work and private. Moved to a new appartment etc. :)

Changed 3 years ago by warwickshaw

comment:9 Changed 3 years ago by warwickshaw

  • Status changed from assigned to closed
  • Resolution set to fixed

In PHP 5.2.3 the ZEND_JMP opcode can sometimes proceed a ZEND_FETCH_CLASS opocde.

The patch checks for this and sets

p->follow = &bb[line_num];

which is the next basic block leader(ZEND_FETCH_CLASS).

This prevents the optimizer from removing the catch block opcodes.

Tested with all the examples from  http://www.w3schools.com/php/php_arrays.asp The examples all throw exceptions!

Warwick Shaw

Changed 3 years ago by warwickshaw

comment:10 Changed 3 years ago by hans

Thanks for your work. See [323] . We're thinking of releasing 0.9.5.2 to address this issue.

comment:11 Changed 3 years ago by bart

A test tarball is available here:  http://bart.eaccelerator.net/source/eaccelerator-0.9.5.2-test.tar.bz2

Please try it to see if this solves these issues

comment:16 Changed 7 months ago by sminnee

  • Status changed from closed to reopened
  • Resolution fixed deleted

This error is occurring in 0.9.6-rc2, PHP 5.3.0, with xdebug enabled.

comment:17 Changed 7 months ago by hans

Err, works fine for me?! That is: without xdebug. Could you test without xdebug to see if that changes anything?

comment:18 Changed 7 months ago by hans

And did you empty your diskcache?

comment:19 Changed 7 months ago by bart

Works fine for me with xdebug enabled.

comment:22 Changed 6 months ago by MaWe4585

  • Version changed from 0.9.5 to 0.9.6

I think the problem is still there.

I have eAccelerator 0.9.6 installed and trying to install Drupal 7 - Alpha2/dev.

Here is the link to the issue  http://drupal.org/node/686596

Would it be possible, that someone looks for it? :)

comment:26 Changed 3 months ago by hans

  • Priority changed from critical to minor
  • Status changed from reopened to new
Note: See TracTickets for help on using tickets.