part of source that read .php script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
korn
Forum Newbie
Posts: 3
Joined: Fri Apr 04, 2003 8:21 am
Location: Croatia

part of source that read .php script

Post by korn »

I study php source code and I need to compile it (php 4.3.1) from source
for windows with some modification on source and my problem is:

I cant locate part of php source code that read file (php script) before
parsing and execution (something like fopen...).

I looked around

Code: Select all

php_execute_script, zend_execute_scripts, zend_compile_file
functions...
It would be wary helpful for me if you can just point my attention on that
part of source code

thanks
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

Why don't you check here?

http://www.php.net/manual/en/zend.php

Cheers,
BDKR
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

take a closer look at
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) and
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
korn
Forum Newbie
Posts: 3
Joined: Fri Apr 04, 2003 8:21 am
Location: Croatia

Post by korn »

Hmm... I looked at this functions but cant find code that read file php script.

then I thought I'll find it in:
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)

If it is not problem, maybe you cat tell me the line number or quote parts of code so I can find it.
Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

the actual parsing is done by a bison parser.
send_language_parser.l

Code: Select all

ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
...
if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
		if (type==ZEND_REQUIRE) {
			zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
			zend_bailout();		
		} else {
			zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
		}
		compilation_successful=0;
	} else {
		init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
		CG(in_compilation) = 1;
		CG(active_op_array) = op_array;
		compiler_result = zendparse(TSRMLS_C); // invokes the parser.
...
Post Reply