diff options
author | Zeev Suraski <zeev@php.net> | 2001-07-21 14:27:56 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-07-21 14:27:56 +0000 |
commit | 336004f4bc72fb5f1a4f8c992d90673960d74856 (patch) | |
tree | d80bc544f0c521734e82cccd5f8fbc81ce8a7e25 /sapi/pi3web/pi3web_sapi.c | |
parent | 931ebe08d7af6f37cb3975dd6fec07449aff0a8f (diff) | |
download | php-git-336004f4bc72fb5f1a4f8c992d90673960d74856.tar.gz |
Improved bailout mechanism, supports nested bailouts a-la try..catch
Note: You may *not* return directly from a catch block
Diffstat (limited to 'sapi/pi3web/pi3web_sapi.c')
-rw-r--r-- | sapi/pi3web/pi3web_sapi.c | 110 |
1 files changed, 56 insertions, 54 deletions
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index eef6920506..362ec133fc 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -382,63 +382,65 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) ELS_FETCH(); PLS_FETCH(); - if (setjmp( EG(bailout)) != 0 ) return PIAPI_ERROR; - - file_handle.filename = lpCB->lpszFileName; - file_handle.free_filename = 0; - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.opened_path = NULL; - - CG(extended_info) = 0; - init_request_info(sapi_globals, lpCB); - php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC); - - hash_pi3web_variables(ELS_C SLS_CC); - - switch ( lpCB->dwBehavior ) { - case PHP_MODE_STANDARD: - iRet = ( php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ) == SUCCESS ) ? - PIAPI_COMPLETED : PIAPI_ERROR; - break; - case PHP_MODE_HIGHLIGHT: { - zend_syntax_highlighter_ini syntax_highlighter_ini; - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) - { - php_get_highlight_struct( &syntax_highlighter_ini ); - zend_highlight( &syntax_highlighter_ini ); - } - else - { - iRet = PIAPI_ERROR; - }; - }; - break; - case PHP_MODE_INDENT: - header_line = (char *)estrdup("Content-Type: text/plain"); - sapi_add_header_ex(header_line, strlen(header_line), 1, 1); - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) - { - zend_indent(); - } - else - { - iRet = PIAPI_ERROR; + zend_try { + file_handle.filename = lpCB->lpszFileName; + file_handle.free_filename = 0; + file_handle.type = ZEND_HANDLE_FILENAME; + file_handle.opened_path = NULL; + + CG(extended_info) = 0; + init_request_info(sapi_globals, lpCB); + php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC); + + hash_pi3web_variables(ELS_C SLS_CC); + + switch ( lpCB->dwBehavior ) { + case PHP_MODE_STANDARD: + iRet = ( php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ) == SUCCESS ) ? + PIAPI_COMPLETED : PIAPI_ERROR; + break; + case PHP_MODE_HIGHLIGHT: { + zend_syntax_highlighter_ini syntax_highlighter_ini; + if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + { + php_get_highlight_struct( &syntax_highlighter_ini ); + zend_highlight( &syntax_highlighter_ini ); + } + else + { + iRet = PIAPI_ERROR; + }; }; - efree(header_line); - break; - case PHP_MODE_LINT: - iRet = (php_lint_script(&file_handle CLS_CC ELS_CC PLS_CC) == SUCCESS) ? - PIAPI_COMPLETED : PIAPI_ERROR; - break; - default: - iRet = PIAPI_ERROR;; - } + break; + case PHP_MODE_INDENT: + header_line = (char *)estrdup("Content-Type: text/plain"); + sapi_add_header_ex(header_line, strlen(header_line), 1, 1); + if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + { + zend_indent(); + } + else + { + iRet = PIAPI_ERROR; + }; + efree(header_line); + break; + case PHP_MODE_LINT: + iRet = (php_lint_script(&file_handle CLS_CC ELS_CC PLS_CC) == SUCCESS) ? + PIAPI_COMPLETED : PIAPI_ERROR; + break; + default: + iRet = PIAPI_ERROR;; + } - if (SG(request_info).cookie_data) { - efree(SG(request_info).cookie_data); - }; + if (SG(request_info).cookie_data) { + efree(SG(request_info).cookie_data); + }; - php_request_shutdown(NULL); + php_request_shutdown(NULL); + } zend_catch { + iRet = PIAPI_ERROR; + } zend_end_try(); return iRet; } |