components/php-5_3/php-sapi/patches/025_php_Zend_zend.c.patch
author Craig Mohrman <craig.mohrman@oracle.com>
Thu, 31 May 2012 14:36:45 -0700
changeset 846 fe258446a1ae
permissions -rw-r--r--
6714149 integrate PHP 5.3 within OpenSolaris

--- php-5.3.10/Zend/zend.c_orig	Sun Jan  1 05:15:04 2012
+++ php-5.3.10/Zend/zend.c	Wed Feb  8 11:25:25 2012
@@ -29,6 +29,7 @@
 #include "zend_builtin_functions.h"
 #include "zend_ini.h"
 #include "zend_vm.h"
+#include "zend_dtrace.h"
 
 #ifdef ZTS
 # define GLOBAL_FUNCTION_TABLE		global_function_table
@@ -636,10 +637,17 @@
 	zend_getenv = utility_functions->getenv_function;
 	zend_resolve_path = utility_functions->resolve_path_function;
 
+#if HAVE_DTRACE
+/* build with dtrace support */
+       zend_compile_file = dtrace_compile_file;
+       zend_execute = dtrace_execute;
+       zend_execute_internal = dtrace_execute_internal;
+#else
 	zend_compile_file = compile_file;
-	zend_compile_string = compile_string;
 	zend_execute = execute;
 	zend_execute_internal = NULL;
+#endif /* HAVE_SYS_SDT_H */
+	zend_compile_string = compile_string;
 	zend_throw_exception_hook = NULL;
 
 	zend_init_opcodes_handlers();
@@ -1039,6 +1047,15 @@
 
 	va_start(args, format);
 
+#ifdef HAVE_DTRACE
+       if(DTRACE_ERROR_ENABLED()) {
+               char *dtrace_error_buffer;
+               zend_vspprintf(&dtrace_error_buffer, 0, format, args);
+               DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
+               efree(dtrace_error_buffer);
+       }
+#endif /* HAVE_DTRACE */
+
 	/* if we don't have a user defined error handler */
 	if (!EG(user_error_handler)
 		|| !(EG(user_error_handler_error_reporting) & type)