Hello,

I just wanted to hear your opinion about providing a hook for
compile_string. We already have a hook called zend_compile_file and it
would be very nice if we could also hook compile_string calls.

Greetings,
Stefan
diff -Nura php-5.2/Zend/zend.c php-5.2-cshook/Zend/zend.c
--- php-5.2/Zend/zend.c 2006-06-05 16:30:49.000000000 +0200
+++ php-5.2-cshook/Zend/zend.c  2006-06-10 14:51:08.000000000 +0200
@@ -595,6 +595,7 @@
        zend_vspprintf = utility_functions->vspprintf_function;
        zend_getenv = utility_functions->getenv_function;
 
+       zend_compile_string = compile_string;
        zend_compile_file = compile_file;
        zend_execute = execute;
        zend_execute_internal = NULL;
diff -Nura php-5.2/Zend/zend_compile.c php-5.2-cshook/Zend/zend_compile.c
--- php-5.2/Zend/zend_compile.c 2006-06-07 12:30:53.000000000 +0200
+++ php-5.2-cshook/Zend/zend_compile.c  2006-06-10 14:50:12.000000000 +0200
@@ -31,6 +31,7 @@
 #include "zend_multibyte.h"
 #endif /* ZEND_MULTIBYTE */
 
+ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char 
*filename TSRMLS_DC);
 ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, 
int type TSRMLS_DC);
 
 
diff -Nura php-5.2/Zend/zend_compile.h php-5.2-cshook/Zend/zend_compile.h
--- php-5.2/Zend/zend_compile.h 2006-05-27 22:30:48.000000000 +0200
+++ php-5.2-cshook/Zend/zend_compile.h  2006-06-10 14:50:04.000000000 +0200
@@ -320,6 +320,7 @@
 void shutdown_compiler(TSRMLS_D);
 void zend_init_compiler_data_structures(TSRMLS_D);
 
+extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, 
char *filename TSRMLS_DC);
 extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle 
*file_handle, int type TSRMLS_DC);
 
 ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
diff -Nura php-5.2/Zend/zend_execute_API.c 
php-5.2-cshook/Zend/zend_execute_API.c
--- php-5.2/Zend/zend_execute_API.c     2006-06-05 16:30:49.000000000 +0200
+++ php-5.2-cshook/Zend/zend_execute_API.c      2006-06-10 14:52:17.000000000 
+0200
@@ -1101,7 +1101,7 @@
 
        original_handle_op_arrays = CG(handle_op_arrays);
        CG(handle_op_arrays) = 0;
-       new_op_array = compile_string(&pv, string_name TSRMLS_CC);
+       new_op_array = zend_compile_string(&pv, string_name TSRMLS_CC);
        CG(handle_op_arrays) = original_handle_op_arrays;
 
        if (new_op_array) {
diff -Nura php-5.2/Zend/zend_vm_def.h php-5.2-cshook/Zend/zend_vm_def.h
--- php-5.2/Zend/zend_vm_def.h  2006-06-08 12:30:48.000000000 +0200
+++ php-5.2-cshook/Zend/zend_vm_def.h   2006-06-10 14:52:25.000000000 +0200
@@ -2766,7 +2766,7 @@
                case ZEND_EVAL: {
                                char *eval_desc = 
zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
 
-                               new_op_array = compile_string(inc_filename, 
eval_desc TSRMLS_CC);
+                               new_op_array = 
zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
                                efree(eval_desc);
                        }
                        break;
diff -Nura php-5.2/Zend/zend_vm_execute.h php-5.2-cshook/Zend/zend_vm_execute.h
--- php-5.2/Zend/zend_vm_execute.h      2006-06-08 12:30:49.000000000 +0200
+++ php-5.2-cshook/Zend/zend_vm_execute.h       2006-06-10 14:52:12.000000000 
+0200
@@ -1960,7 +1960,7 @@
                case ZEND_EVAL: {
                                char *eval_desc = 
zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
 
-                               new_op_array = compile_string(inc_filename, 
eval_desc TSRMLS_CC);
+                               new_op_array = 
zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
                                efree(eval_desc);
                        }
                        break;
@@ -4460,7 +4460,7 @@
                case ZEND_EVAL: {
                                char *eval_desc = 
zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
 
-                               new_op_array = compile_string(inc_filename, 
eval_desc TSRMLS_CC);
+                               new_op_array = 
zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
                                efree(eval_desc);
                        }
                        break;
@@ -7542,7 +7542,7 @@
                case ZEND_EVAL: {
                                char *eval_desc = 
zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
 
-                               new_op_array = compile_string(inc_filename, 
eval_desc TSRMLS_CC);
+                               new_op_array = 
zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
                                efree(eval_desc);
                        }
                        break;
@@ -19764,7 +19764,7 @@
                case ZEND_EVAL: {
                                char *eval_desc = 
zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
 
-                               new_op_array = compile_string(inc_filename, 
eval_desc TSRMLS_CC);
+                               new_op_array = 
zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
                                efree(eval_desc);
                        }
                        break;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to