| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | CATCH bug demonstration
|
|---|
| 5 |
|
|---|
| 6 | BUG PRESENT in PHP 5.2.5 with eAccelerator 0.9.5.3
|
|---|
| 7 |
|
|---|
| 8 | Bug not present in PHP 5.2.5 without eAccelerator (disabled through php.ini)
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | error_reporting(E_ALL);
|
|---|
| 12 |
|
|---|
| 13 | class LocalException extends Exception {}
|
|---|
| 14 |
|
|---|
| 15 | function main()
|
|---|
| 16 | {
|
|---|
| 17 | echo "main() inv<br>";
|
|---|
| 18 |
|
|---|
| 19 | try
|
|---|
| 20 | {
|
|---|
| 21 | # Comment all *{n} blocks and Exception will be caught
|
|---|
| 22 | # Enable only *2 and Exception WILL NOT be caught (BUG?)
|
|---|
| 23 | # Enable only *4 and Exception WILL NOT be caught (BUG?)
|
|---|
| 24 | # Enable only *1 and *2 and Exception will be caught
|
|---|
| 25 | # Enable only *2 and *3 and Exception will be caught
|
|---|
| 26 |
|
|---|
| 27 | # echo "*1<br>"; # *1
|
|---|
| 28 | if (0) {} # *2
|
|---|
| 29 | # echo "*3<br>"; # *3
|
|---|
| 30 | # if (1) {} # *4
|
|---|
| 31 |
|
|---|
| 32 | try
|
|---|
| 33 | {
|
|---|
| 34 | throw new Exception("thrown from try-2");
|
|---|
| 35 | } catch (LocalException $e) {} # must not sense exception thrown
|
|---|
| 36 | } catch (Exception $e)
|
|---|
| 37 | {
|
|---|
| 38 | echo "Caught Exception (all OK)<br>";
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | echo "main() finished<br>";
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | main();
|
|---|
| 45 |
|
|---|
| 46 | ?> |
|---|