[phc-internals] [phc] r3301 committed - Compiling code using $php_errormsg didn't work....

codesite-noreply at google.com codesite-noreply at google.com
Mon Oct 5 18:33:08 IST 2009


Revision: 3301
Author: paul.biggar
Date: Mon Oct  5 10:32:16 2009
Log: Compiling code using $php_errormsg didn't work.
This no longer prunes symbol tables if $php_errormsg is used.
This could be implemented more efficiently, but is fine for now.
Thanks to jeanroch.rossi for the bug report.

http://code.google.com/p/phc/source/detail?r=3301

Added:
  /trunk/test/subjects/bugs/bug0030.php
Modified:
  /trunk/src/optimize/Prune_symbol_table.cpp

=======================================
--- /dev/null
+++ /trunk/test/subjects/bugs/bug0030.php	Mon Oct  5 10:32:16 2009
@@ -0,0 +1,16 @@
+<?php
+
+	// php_errormsg didn't work.
+	// Bug report from jeanroch.rossi
+
+	ini_set("track_errors", true);
+
+	function show_error()
+	{
+			  @strpos();
+			  $error_message = $php_errormsg;
+			  echo "inside the function : $error_message \n";
+	}
+
+	show_error();
+?>
=======================================
--- /trunk/src/optimize/Prune_symbol_table.cpp	Wed Dec  3 10:16:39 2008
+++ /trunk/src/optimize/Prune_symbol_table.cpp	Mon Oct  5 10:32:16 2009
@@ -111,6 +111,11 @@
  		// record variable names for removing globals
  		if (record_globals)
  			(*vars)[*in->value] = true;
+
+		// Dont do this optimization in the presence of php_errormsg.
+		// There are much better ways of doing this, but this is the simplest.
+		if (*in->value == "php_errormsg")
+			prune = false;
  	}

  	void post_variable_variable (Variable_variable* in)


More information about the phc-internals mailing list