Hi,
I am trying to get a PHP 4.3.2 SAPI working on Windows.
I am using Visual Studio 6.0 and am using the Debug Release
(php4ts_debug.dll).
I can successfully get the CLI (phpCLI.c) version of PHP working just fine
using the same linking instructions as I do for my SAPI program.
My SAPI is heavily based off the thttpd sample SAPI.
Right now I am getting a "Microsoft Visual C++ Debug Library" assertion:
--- Begin Dialog Contents ---
Debug Assertion Failed!
Program: c:\work\out\bin\phpServerHarness.exe
File: fdopen.c
Line: 54
Expression: _osfile(filedes) & FOPEN
For information on how your program can cause an asserion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application).
--- End Dialog Contents ---
Here is the code from fdopen.c:
--- Begin Code ---
FILE * __cdecl _tfdopen (
int filedes,
REG2 const _TSCHAR *mode
)
{
REG1 FILE *stream;
int whileflag, tbflag, cnflag;
_ASSERTE(mode != NULL);
#if defined (_WIN32)
_ASSERTE((unsigned)filedes < (unsigned)_nhandle);
_ASSERTE(_osfile(filedes) & FOPEN); // <------------ THIS ASSERT
if ( ((unsigned)filedes >= (unsigned)_nhandle) ||
!(_osfile(filedes) & FOPEN) )
return(NULL);
#else /* defined (_WIN32) */
--- End Code ---
This is the stack at the time of the assert:
--- Begin Stack ---
> MSVCRTD.DLL!_fdopen(int filedes=3, const char * mode=0x010d545c) Line
54 + 0x3f C
php4ts_debug.dll!php_stdiop_cast(_php_stream * stream=0x010d5438, int
castas=0, void * * ret=0x010ce738, void * * * tsrm_ls=0x00e39b90) Line
1580 + 0x16 C
php4ts_debug.dll!_php_stream_cast(_php_stream * stream=0x010d5438, int
castas=0, void * * ret=0x010ce738, int show_err=8, void * * *
tsrm_ls=0x00e39b90) Line 2172 + 0x39 C
php4ts_debug.dll!_php_stream_open_wrapper_as_file(char *
path=0x00e87830, char * mode=0x102adfd4, int options=141, char * *
opened_path=0x010ceb60, int __php_stream_call_depth=0, char *
__zend_filename=0x102ae704, unsigned int __zend_lineno=762, char *
__zend_orig_filename=0x00000000, unsigned int __zend_orig_lineno=0, void
* * * tsrm_ls=0x00e39b90) Line 2718 + 0x18 C
php4ts_debug.dll!php_fopen_wrapper_for_zend(const char *
filename=0x00e87830, char * * opened_path=0x010ceb60) Line 762 + 0x31 C
php4ts_debug.dll!open_file_for_scanning(_zend_file_handle *
file_handle=0x010ceb58, void * * * tsrm_ls=0x00e39b90) Line 2982 +
0x16 C
php4ts_debug.dll!compile_file(_zend_file_handle *
file_handle=0x010ceb58, int type=2, void * * * tsrm_ls=0x00e39b90) Line
3081 + 0xd C
php4ts_debug.dll!zend_execute_scripts(int type=8, void * * *
tsrm_ls=0x00e39b90, _zval_struct * * retval=0x00000000, int
file_count=3, ...) Line 865 + 0x12 C
php4ts_debug.dll!php_execute_script(_zend_file_handle *
primary_file=0x010ceb58, void * * * tsrm_ls=0x00e39b90) Line 1671 +
0x1b C
phpServerHarness.exe!thttpd_module_main(int show_source=0, void * * *
tsrm_ls=0x00e39b90) Line 534 + 0xe C
phpServerHarness.exe!thttpd_real_php_request(void * * hc=0x00e38750, int
show_source=0, void * * * tsrm_ls=0x00e39b90) Line 923 + 0xd C
phpServerHarness.exe!phpcinterface_php_request(void * hc=0x00e38750, int
show_source=0) Line 978 + 0x11 C
phpServerHarness.exe!HTTPConnectionDataSourcePHP::primePump() Line 31 +
0xe C++
phpServerHarness.exe!HTTPConnection::handleCompleteRequest() Line 283 C++
phpServerHarness.exe!HTTPConnection::inspectIncoming() Line 363 C++
phpServerHarness.exe!SocketConnection::readAvailable() Line 72 C++
phpServerHarness.exe!SocketWatcher::run() Line 172 C++
phpServerHarness.exe!threadLaunchFunc(void * userArg=0x00d918f0) Line
25 C++
MSVCRTD.DLL!_threadstart(void * ptd=0x00e388f0) Line 173 + 0xd C
KERNEL32.DLL!77e8758a()
-- End Stack ---
The place where I "lose track" (in terms of understanding) of what's
happening is in:
_php_open_wrapper_as_file()
where it takes a phpstream returned from:
php_stream_open_wrapper_rel()
and does:
if (php_stream_cast(stream,
PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_TRY_HARD|PHP_STREAM_CAST_RELEASE,
(void**)&fp, REPORT_ERRORS) == FAILURE)
to it. I don't really know "what" they're trying to do from then on, but
it goes through a few functions (see stack) and ends up at that assert.
The arguments to php_open_wrapper_as_file look correct (valid paths).
I know this is a long shot, but if anyone can help me -- give me some kind
of pointer on where or what to look for -- libraries, languages,
ThreadSafe versus not ThreadSafe -- I'd really appreciate it. I've been
stumped for days. I don't really know how to get more information on the
code I'm looking at.
thanks!
twitch
--
PHP Install Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php