Hi,
I wanna add some c code into eval(string) let it can check string's syntax.
But I don't know which file(*.c) has the source code of eval().
Please give me some guidance or direction.
Thanks!
source code: eval()
Moderator: General Moderators
Re: source code: eval()
Thank you, astions.
I wanna do another work in eval(), like certificate, etc..
I know PHP has openssl_private_encrypt, php_check_syntax(), ... functions.
But I must modify the source code of eval().
So, can you tell me which file I need modify?
Thank you for you.
I wanna do another work in eval(), like certificate, etc..
I know PHP has openssl_private_encrypt, php_check_syntax(), ... functions.
But I must modify the source code of eval().
So, can you tell me which file I need modify?
Thank you for you.
Re: source code: eval()
I'm not sure what file it is in, but I have downloaded the source and it is quite organized. It's most likely in a file called eval.c or close to that at least.
Re: source code: eval()
There is no file name like "*eval*".
PHP is a interprete lanaguage, I think eval will be extractd from *.php by php syntax analyzer.
So, I use UltraEdit to find "eval" in all *.c.
But the result is large as mountain. I can't identify which section is used for eval().
PHP is a interprete lanaguage, I think eval will be extractd from *.php by php syntax analyzer.
So, I use UltraEdit to find "eval" in all *.c.
But the result is large as mountain. I can't identify which section is used for eval().
Re: source code: eval()
I find the eval in source files (php-5.2.9.tar.gz).
I filtered the result and list:
========================================================================
ext/pcre/php_pcre.c (line 854):
static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
int *offsets, int count, char **result TSRMLS_DC)
{
......
}
main/main.c (line 598):
switch (EG(current_execute_data)->opline->op2.u.constant.value.lval)
{
case ZEND_EVAL:
function = "eval";
is_function = 1;
break;
......
}
Zend/zend_builtin_functions.c (line 1828):
switch (Z_LVAL(ptr->opline->op2.u.constant))
{
case ZEND_EVAL:
function_name = "eval";
build_filename_arg = 0;
break;
......
}
Zend/zend_vm_def.c (line 2896):
case ZEND_EVAL:
{
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
efree(eval_desc);
}
break;
Zend/zend_vm_execute.c (line 2060):
case ZEND_EVAL:
{
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
efree(eval_desc);
}
break;
========================================================================
And, are these files right?
I filtered the result and list:
========================================================================
ext/pcre/php_pcre.c (line 854):
static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
int *offsets, int count, char **result TSRMLS_DC)
{
......
}
main/main.c (line 598):
switch (EG(current_execute_data)->opline->op2.u.constant.value.lval)
{
case ZEND_EVAL:
function = "eval";
is_function = 1;
break;
......
}
Zend/zend_builtin_functions.c (line 1828):
switch (Z_LVAL(ptr->opline->op2.u.constant))
{
case ZEND_EVAL:
function_name = "eval";
build_filename_arg = 0;
break;
......
}
Zend/zend_vm_def.c (line 2896):
case ZEND_EVAL:
{
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
efree(eval_desc);
}
break;
Zend/zend_vm_execute.c (line 2060):
case ZEND_EVAL:
{
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
efree(eval_desc);
}
break;
========================================================================
And, are these files right?
Re: source code: eval()
Well...
I found it.
ext/pcre/php_pcre.c
before line 921.
Thanks everybody.
I found it.
ext/pcre/php_pcre.c
before line 921.
Thanks everybody.