--- zend_execute.c Wed Aug 14 17:45:02 2002 +++ zend_execute.c_new Wed Aug 14 17:42:18 2002 @@ -2084,6 +2084,7 @@ case ZEND_REQUIRE_ONCE: { char *opened_path=NULL; int dummy = 1; + int remote_file = 0; zend_file_handle file_handle; file_handle.handle.fp = zend_fopen(inc_filename->value.str.val, &opened_path); @@ -2093,9 +2094,15 @@ file_handle.free_filename = 0; if (file_handle.handle.fp) { - if (!opened_path || zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { + if( !opened_path ) { + opened_path = estrdup(inc_filename->value.str.val); + remote_file = 1; + } + + if (zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { new_op_array = zend_compile_file(&file_handle, (EX(opline)->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); + if( remote_file ) efree(opened_path); opened_path = NULL; /* zend_destroy_file_handle() already frees it */ } else { fclose(file_handle.handle.fp);