Re: cvs: php4 /main main.c /sapi/cgi cgi_main.c /sapi/cli php_cli.c /sapi/pi3web pi3web_sapi.c

From: Date: Thu, 14 Feb 2002 22:25:19 +0000
Subject: Re: cvs: php4 /main main.c /sapi/cgi cgi_main.c /sapi/cli php_cli.c /sapi/pi3web pi3web_sapi.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9379@lists.php.net to get a copy of this message
Exit status == -1 doesn't sound right to me. They can range from 0-255. Andi At 08:16 PM 2/14/2002 +0000, Derick Rethans wrote:
derick          Thu Feb 14 15:16:08 2002 EDT
Modified files:
    /php4/main  main.c
    /php4/sapi/pi3web   pi3web_sapi.c
    /php4/sapi/cgi      cgi_main.c
    /php4/sapi/cli      php_cli.c
Log: - Let php_execute_script return 0 on failure and 1 on sucess, and change
    SAPIs accordingly. (Andrei, Derick)
Index: php4/main/main.c diff -u php4/main/main.c:1.421 php4/main/main.c:1.422
--- php4/main/main.c:1.421      Tue Feb  5 01:31:53 2002
+++ php4/main/main.c    Thu Feb 14 15:16:05 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: main.c,v 1.421 2002/02/05 06:31:53 yohgaki Exp $ */ +/* $Id: main.c,v 1.422 2002/02/14 20:16:05 derick Exp $ */ /* {{{ includes */ @@ -1287,6 +1287,7 @@
        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 @@
                } 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: php4/sapi/pi3web/pi3web_sapi.c diff -u php4/sapi/pi3web/pi3web_sapi.c:1.38 php4/sapi/pi3web/pi3web_sapi.c:1.39 --- php4/sapi/pi3web/pi3web_sapi.c:1.38 Sat Feb 2 14:53:42 2002
+++ php4/sapi/pi3web/pi3web_sapi.c      Thu Feb 14 15:16:07 2002
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: pi3web_sapi.c,v 1.38 2002/02/02 19:53:42 sebastian Exp $ */ +/* $Id: pi3web_sapi.c,v 1.39 2002/02/14 20:16:07 derick Exp $ */ #include "pi3web_sapi.h" #include "php.h" @@ -77,7 +77,7 @@
        PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
        PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n");
        php_info_print_table_header(2, "Information Field", "Value");
-       php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.38 2002/02/02 19:53:42 sebastian Exp $");
+       php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.39 2002/02/14 20:16:07 derick Exp $");
        php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp());
        snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled());
        php_info_print_table_row(2, "Debug Enabled", variable_buf);
@@ -391,7 +391,7 @@
                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: {
Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.143 php4/sapi/cgi/cgi_main.c:1.144
--- php4/sapi/cgi/cgi_main.c:1.143      Sat Feb  2 14:53:42 2002
+++ php4/sapi/cgi/cgi_main.c    Thu Feb 14 15:16:08 2002
@@ -756,7 +756,11 @@
                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: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.5 php4/sapi/cli/php_cli.c:1.6 --- php4/sapi/cli/php_cli.c:1.5 Thu Feb 14 11:45:07 2002
+++ php4/sapi/cli/php_cli.c     Thu Feb 14 15:16:08 2002
@@ -552,7 +552,11 @@
                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;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#9379) next »