From: Derick Rethans Date: Thu, 14 Feb 2002 20:16:08 +0000 (+0000) Subject: - Let php_execute_script return 0 on failure and 1 on sucess, and change X-Git-Tag: php-4.2.0RC1~338 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86fa2d39379752044287530f31f21532380eeb19;p=php - Let php_execute_script return 0 on failure and 1 on sucess, and change SAPIs accordingly. (Andrei, Derick) --- diff --git a/main/main.c b/main/main.c index b770ccfe3e..c88ea7fc97 100644 --- a/main/main.c +++ b/main/main.c @@ -1287,6 +1287,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file, append_file; char *old_cwd; + int retval = 0; EG(exit_status) = 0; if (php_handle_special_queries(TSRMLS_C)) { @@ -1327,14 +1328,14 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) } else { append_file_p = NULL; } - zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p); + retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); } zend_end_try(); if (old_cwd[0] != '\0') { VCWD_CHDIR(old_cwd); } free_alloca(old_cwd); - return EG(exit_status); + return retval; } /* }}} */ diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 71fc3289f4..41839cb4ad 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -756,7 +756,11 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine switch (behavior) { case PHP_MODE_STANDARD: - exit_status = php_execute_script(&file_handle TSRMLS_CC); + if (php_execute_script(&file_handle TSRMLS_CC)) { + exit_status = EG(exit_status); + } else { + exit_status = -1; + } break; case PHP_MODE_LINT: PG(during_request_startup) = 0; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 4bcb0e3357..cf6ffdcd70 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -552,7 +552,11 @@ int main(int argc, char *argv[]) switch (behavior) { case PHP_MODE_STANDARD: - exit_status = php_execute_script(&file_handle TSRMLS_CC); + if (php_execute_script(&file_handle TSRMLS_CC)) { + exit_status = EG(exit_status); + } else { + exit_status = -1; + } break; case PHP_MODE_LINT: PG(during_request_startup) = 0; diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index 10394acc65..cbfcef3f0f 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -391,7 +391,7 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) switch ( lpCB->dwBehavior ) { case PHP_MODE_STANDARD: - iRet = ( php_execute_script( &file_handle TSRMLS_CC ) == SUCCESS ) ? + iRet = ( php_execute_script( &file_handle TSRMLS_CC ) ) ? PIAPI_COMPLETED : PIAPI_ERROR; break; case PHP_MODE_HIGHLIGHT: {