Ticket #317 (closed defect: duplicate)

Opened 2 years ago

Last modified 2 months ago

Exception not caught if try() is placed next to if() statement

Reported by: dadooda Assigned to: hans
Priority: major Milestone:
Component: Optimizer Version: 0.9.5
Keywords: Cc:

Description

Hi team.

The bug I'm posting is somehow similar to #314. The demo script is below.

<?php

/*
	CATCH bug demonstration

	BUG PRESENT in PHP 5.2.5 with eAccelerator 0.9.5.3

	Bug not present in PHP 5.2.5 without eAccelerator (disabled through php.ini)
*/

error_reporting(E_ALL);

class LocalException extends Exception {}

function main()
{
	echo "main() inv<br>";

	try
	{
		# Comment all *{n} blocks and Exception will be caught
		# Enable only *2 and Exception WILL NOT be caught (BUG?)
		# Enable only *4 and Exception WILL NOT be caught (BUG?)
		# Enable only *1 and *2 and Exception will be caught
		# Enable only *2 and *3 and Exception will be caught

#		echo "*1<br>";		# *1
		if (0) {}			# *2
#		echo "*3<br>";		# *3
#		if (1) {}			# *4

		try
		{
			throw new Exception("thrown from try-2");
		} catch (LocalException $e) {}	# must not sense exception thrown
	} catch (Exception $e)
	{
		echo "Caught Exception (all OK)<br>";
	}

	echo "main() finished<br>";
}

main();

?>

Attachments

a-catchbug-mini.php (0.9 kB) - added by dadooda on 10/16/08 23:55:54.

Change History

10/16/08 23:55:54 changed by dadooda

  • attachment a-catchbug-mini.php added.

10/22/08 14:16:10 changed by jgitlin

I can reproduce this bug on PHP Version 5.2.6 with eAccelerator v0.9.5.3. It caught me off guard when I was writing my code, I couldn't figure out why an

if(false) { }

was causing a catch{} block to be skipped! I can post my code if needed, but it was buried deep inside a class. dadooda's code successfully reproduces this bug for me.

10/22/08 14:35:05 changed by jgitlin

  • owner changed from somebody to hans.
  • component changed from eAccelerator to Optimizer.

I believe this is an optimizer bug as clearing the cache and setting eaccelerator.optimizer = "0" causes code to execute as expected.

05/06/09 21:16:24 changed by bart

  • status changed from new to closed.
  • resolution set to duplicate.

I think this is a duplicate of #291

05/27/09 09:28:29 changed by linksoflondon

links of london is here.links of london Links of London - This exquisite range is available from our online shop as well as free delivery on all orders– Visit us now! Links of London, Pandora and Links of London is one of the best online jewelry stores. A wide selection of fine quality gold, silver and diamond including Links of London CharmLinks of London Bracelet

02/24/10 10:59:11 changed by sim

decoration Changed 1 year ago by admin

bathtub Changed 1 year ago by admin

solar system Changed 1 year ago by admin

stair parts Changed 1 year ago by admin

solar supply Changed 1 year ago by admin

05/25/10 16:19:28 changed by bascorp