]> granicus.if.org Git - php/commitdiff
- Let php_execute_script return 0 on failure and 1 on sucess, and change
authorDerick Rethans <derick@php.net>
Thu, 14 Feb 2002 20:16:08 +0000 (20:16 +0000)
committerDerick Rethans <derick@php.net>
Thu, 14 Feb 2002 20:16:08 +0000 (20:16 +0000)
  SAPIs accordingly. (Andrei, Derick)

main/main.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/pi3web/pi3web_sapi.c

index b770ccfe3e8bfeb6f13d414d0e7a6e10a6af24f4..c88ea7fc979bd84f32ba6c89ba2380acb6b2d9a1 100644 (file)
@@ -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;
 }
 /* }}} */
 
index 71fc3289f413a6c5aa141c2e630d14e5a07a316d..41839cb4ad487d94284571fb71e47ae421203177 100644 (file)
@@ -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;
index 4bcb0e33575a8608c14d52eacb901a8e65809935..cf6ffdcd7089a93b1a01da7be766eecc23a262d2 100644 (file)
@@ -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;
index 10394acc657e7b138e0436797337ec9b972827a2..cbfcef3f0f435f82e5b9a2b06f729b36409d4d60 100644 (file)
@@ -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: {