[xdebug-dev] xdebug xdebug/xdebug.c eval($x); doesn't segfault anymore.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Wed, 21 Sep 2005 11:01:51 +0200

Date: Wed Sep 21 11:01:49 CEST 2005
User: Derick Rethans
Directory: xdebug

Log Message:
- Added support for PHP 5.1 and higher's IS_CV, so that $x = "bar();";
  eval($x); doesn't segfault anymore.

Modified files:
           xdebug/xdebug.c (version: 1.274)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -r1.273 -r1.274
--- xdebug/xdebug.c:1.273 Wed Sep 21 06:28:37 2005 GMT
+++ xdebug/xdebug.c Wed Sep 21 07:01:49 2005 GMT
@@ -115,7 +115,7 @@
 int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS);
 #endif
 
-static zval *get_zval(znode *node, temp_variable *Ts, int *is_var);
+static zval *get_zval(zend_execute_data *zdata, znode *node, temp_variable *Ts, int *is_var);
 static char* return_trace_stack_frame_begin(function_stack_entry* i, int fnr TSRMLS_DC);
 static char* return_trace_stack_frame_end(function_stack_entry* i, int fnr TSRMLS_DC);
 static char* return_trace_stack_retval(function_stack_entry* i, zval* retval TSRMLS_DC);
@@ -939,7 +939,7 @@
                 if (tmp->function.type == XFUNC_EVAL) {
                         int is_var;
 
- tmp->include_filename = get_zval_value(get_zval(&zdata->opline->op1, zdata->Ts, &is_var), 0);
+ tmp->include_filename = get_zval_value(get_zval(zdata, &zdata->opline->op1, zdata->Ts, &is_var), 0);
                 } else if (XG(collect_includes)) {
                         tmp->include_filename = xdstrdup(zend_get_executed_filename(TSRMLS_C));
                 }
@@ -2227,7 +2227,7 @@
 /*************************************************************************************************************************************/
 #define T(offset) (*(temp_variable *)((char *) Ts + offset))
 
-static zval *get_zval(znode *node, temp_variable *Ts, int *is_var)
+static zval *get_zval(zend_execute_data *zdata, znode *node, temp_variable *Ts, int *is_var)
 {
         switch (node->op_type) {
                 case IS_CONST:
@@ -2260,6 +2260,12 @@
 #endif
                         break;
 
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1) || (PHP_MAJOR_VERSION >= 6)
+ case IS_CV:
+ return *zend_get_compiled_variable_value(zdata, node->u.constant.value.lval);
+ break;
+#endif
+
                 case IS_UNUSED:
                         fprintf(stderr, "\nIS_UNUSED\n");
                         break;
Received on Wed Sep 21 2005 - 11:01:57 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST