Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
MFH? (what exactly did this fix/change? :) --Jani On Mon, 16 Jun 2003, Stanislav Malyshev wrote: stas Mon Jun 16 12:14:38 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: flush after banner print Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.94 php4/sapi/cli/php_cli.c:1.95 --- php4/sapi/cli/php_cli.c:1.94 Tue Jun 10 16:03:45 2003 +++ php4/sapi/cli/php_cli.cMon Jun 16 12:14:38 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.94 2003/06/10 20:03:45 imajes Exp $ */ +/* $Id: php_cli.c,v 1.95 2003/06/16 16:14:38 stas Exp $ */ #include php.h #include php_globals.h @@ -680,6 +680,7 @@ case 'a': /* interactive mode */ printf(Interactive mode enabled\n\n); + fflush(stdout); interactive=1; break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
Well, it mostly fixed the tests :) The problem is that if one doesn't flush, then on console everything is OK, but if you use some buffered stream (e.g., popen, or even maybe file) then the banner can get inside the rest of the output and not at the start. Using interactive mode outside console is a bit esoteric, but the tests did fail. I'm not sure if it really requires merging... JT JT MFH? (what exactly did this fix/change? :) JT JT --Jani JT JT On Mon, 16 Jun 2003, Stanislav Malyshev wrote: JT JT stas Mon Jun 16 12:14:38 2003 EDT JT JT Modified files: JT /php4/sapi/cliphp_cli.c JT Log: JT flush after banner print JT JT JT Index: php4/sapi/cli/php_cli.c JT diff -u php4/sapi/cli/php_cli.c:1.94 php4/sapi/cli/php_cli.c:1.95 JT --- php4/sapi/cli/php_cli.c:1.94 Tue Jun 10 16:03:45 2003 JT +++ php4/sapi/cli/php_cli.c Mon Jun 16 12:14:38 2003 JT @@ -19,7 +19,7 @@ JT +--+ JT */ JT JT -/* $Id: php_cli.c,v 1.94 2003/06/10 20:03:45 imajes Exp $ */ JT +/* $Id: php_cli.c,v 1.95 2003/06/16 16:14:38 stas Exp $ */ JT JT #include php.h JT #include php_globals.h JT @@ -680,6 +680,7 @@ JT JT case 'a': /* interactive mode */ JT printf(Interactive mode enabled\n\n); JT + fflush(stdout); JT interactive=1; JT break; JT JT -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.109 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
Sounds like something nobody else than you needs? :) No need to merge, no bug reports (AFAIK) about this either. --Jani On Tue, 17 Jun 2003, Stanislav Malyshev wrote: Well, it mostly fixed the tests :) The problem is that if one doesn't flush, then on console everything is OK, but if you use some buffered stream (e.g., popen, or even maybe file) then the banner can get inside the rest of the output and not at the start. Using interactive mode outside console is a bit esoteric, but the tests did fail. I'm not sure if it really requires merging... JT JT MFH? (what exactly did this fix/change? :) JT JT --Jani JT JT On Mon, 16 Jun 2003, Stanislav Malyshev wrote: JT JT stas Mon Jun 16 12:14:38 2003 EDT JT JT Modified files: JT /php4/sapi/cli php_cli.c JT Log: JT flush after banner print JT JT JT Index: php4/sapi/cli/php_cli.c JT diff -u php4/sapi/cli/php_cli.c:1.94 php4/sapi/cli/php_cli.c:1.95 JT --- php4/sapi/cli/php_cli.c:1.94 Tue Jun 10 16:03:45 2003 JT +++ php4/sapi/cli/php_cli.c Mon Jun 16 12:14:38 2003 JT @@ -19,7 +19,7 @@ JT +--+ JT */ JT JT -/* $Id: php_cli.c,v 1.94 2003/06/10 20:03:45 imajes Exp $ */ JT +/* $Id: php_cli.c,v 1.95 2003/06/16 16:14:38 stas Exp $ */ JT JT #include php.h JT #include php_globals.h JT @@ -680,6 +680,7 @@ JT JT case 'a': /* interactive mode */ JT printf(Interactive mode enabled\n\n); JT +fflush(stdout); JT interactive=1; JT break; JT JT -- https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
stasMon Jun 16 12:14:38 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: flush after banner print Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.94 php4/sapi/cli/php_cli.c:1.95 --- php4/sapi/cli/php_cli.c:1.94Tue Jun 10 16:03:45 2003 +++ php4/sapi/cli/php_cli.c Mon Jun 16 12:14:38 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.94 2003/06/10 20:03:45 imajes Exp $ */ +/* $Id: php_cli.c,v 1.95 2003/06/16 16:14:38 stas Exp $ */ #include php.h #include php_globals.h @@ -680,6 +680,7 @@ case 'a': /* interactive mode */ printf(Interactive mode enabled\n\n); + fflush(stdout); interactive=1; break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Thu May 29 10:45:03 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Simply print errors Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.90 php4/sapi/cli/php_cli.c:1.91 --- php4/sapi/cli/php_cli.c:1.90Mon May 26 14:37:48 2003 +++ php4/sapi/cli/php_cli.c Thu May 29 10:45:03 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.90 2003/05/26 18:37:48 derick Exp $ */ +/* $Id: php_cli.c,v 1.91 2003/05/29 14:45:03 helly Exp $ */ #include php.h #include php_globals.h @@ -239,11 +239,7 @@ static void sapi_cli_log_message(char *message) { - TSRMLS_FETCH(); - - if (php_header(TSRMLS_C)) { - fprintf(stderr, %s\n, message); - } + fprintf(stderr, %s\n, message); } static int sapi_cli_deactivate(TSRMLS_D) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Thu May 29 20:11:37 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: MFB Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.91 php4/sapi/cli/php_cli.c:1.92 --- php4/sapi/cli/php_cli.c:1.91Thu May 29 10:45:03 2003 +++ php4/sapi/cli/php_cli.c Thu May 29 20:11:37 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.91 2003/05/29 14:45:03 helly Exp $ */ +/* $Id: php_cli.c,v 1.92 2003/05/30 00:11:37 helly Exp $ */ #include php.h #include php_globals.h @@ -76,6 +76,10 @@ #include php_getopt.h + +#ifndef O_BINARY +#define O_BINARY 0 +#endif #define PHP_MODE_STANDARD 1 #define PHP_MODE_HIGHLIGHT 2 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Sun Mar 30 09:00:09 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: more ini defaults for error message handling Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.78 php4/sapi/cli/php_cli.c:1.79 --- php4/sapi/cli/php_cli.c:1.78Sun Mar 30 06:07:36 2003 +++ php4/sapi/cli/php_cli.c Sun Mar 30 09:00:09 2003 @@ -293,6 +293,8 @@ INI_DEFAULT(register_argc_argv, 1); INI_DEFAULT(html_errors, 0); + INI_DEFAULT(report_zend_debug, 0); + INI_DEFAULT(display_errors, 1); INI_DEFAULT(implicit_flush, 1); INI_DEFAULT(max_execution_time, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
derick Sat Mar 29 15:57:31 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: - html errors should default to off (0) in CLI Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.75 php4/sapi/cli/php_cli.c:1.76 --- php4/sapi/cli/php_cli.c:1.75Tue Mar 25 03:07:13 2003 +++ php4/sapi/cli/php_cli.c Sat Mar 29 15:57:31 2003 @@ -293,7 +293,7 @@ MAKE_STD_ZVAL(tmp); INI_DEFAULT(register_argc_argv, 19, 1); - INI_DEFAULT(html_errors, 12, 1); + INI_DEFAULT(html_errors, 12, 0); INI_DEFAULT(implicit_flush, 15, 1); INI_DEFAULT(max_execution_time, 19, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
On Sat, 29 Mar 2003, Derick Rethans wrote: MAKE_STD_ZVAL(tmp); INI_DEFAULT(register_argc_argv, 19, 1); - INI_DEFAULT(html_errors, 12, 1); + INI_DEFAULT(html_errors, 12, 0); INI_DEFAULT(implicit_flush, 15, 1); INI_DEFAULT(max_execution_time, 19, 0); Why are we specifying the length of the string explicitly? Is there something wrong with sizeof() since the last time I checked? -Andrei http://www.gravitonic.com/ For society, it's probably a good thing that engineers value function over appearance. For example, you wouldn't want engineers to build nuclear power plants that only _look_ like they would keep all the radiation inside. (Scott Adams - The Dilbert principle) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Sat Mar 29 16:23:53 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: use sizeof() as suggested by Andrei Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.76 php4/sapi/cli/php_cli.c:1.77 --- php4/sapi/cli/php_cli.c:1.76Sat Mar 29 15:57:31 2003 +++ php4/sapi/cli/php_cli.c Sat Mar 29 16:23:53 2003 @@ -281,9 +281,9 @@ /* {{{ sapi_cli_ini_defaults */ -#define INI_DEFAULT(name,name_len,value)\ +#define INI_DEFAULT(name,value)\ ZVAL_STRING(tmp, value, 0);\ - zend_hash_update(configuration_hash, name, name_len, tmp, sizeof(zval), (void**)entry);\ + zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)entry);\ Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) static void sapi_cli_ini_defaults(HashTable *configuration_hash) @@ -292,10 +292,10 @@ MAKE_STD_ZVAL(tmp); - INI_DEFAULT(register_argc_argv, 19, 1); - INI_DEFAULT(html_errors, 12, 0); - INI_DEFAULT(implicit_flush, 15, 1); - INI_DEFAULT(max_execution_time, 19, 0); + INI_DEFAULT(register_argc_argv, 1); + INI_DEFAULT(html_errors, 0); + INI_DEFAULT(implicit_flush, 1); + INI_DEFAULT(max_execution_time, 0); FREE_ZVAL(tmp); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
I found the cause of the problem, that mbstring doesn't use INI property values themselves and it only updates the appropriate MBSTRG member in the INI handlers. Any ideas? Moriyoshi [EMAIL PROTECTED] (Marcus Börger) wrote: snip There must be something else (i tested all combinations before i committed) but did it again now and here are the results: [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini html_errors = On [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=0 -r 'var_dump(ini_get(html_errors));' string(1) 0 [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini html_errors = Off [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini ;html_errors = Off [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=0 -r 'var_dump(ini_get(html_errors));' string(1) 0 However you reminded me that i must change the default setting. marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
Sorry for being a bit late, but this commit broke BC. I cannot override php.ini settings by -d options any more. Moriyoshi Marcus Boerger [EMAIL PROTECTED] wrote: helly Tue Mar 18 10:56:12 2003 EDT Modified files: /php4/sapi/cliphp_cli.c Log: use new callback to overwrite ini settings # ok now lets split html_errors and phpinfo() formatting Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.71 php4/sapi/cli/php_cli.c:1.72 --- php4/sapi/cli/php_cli.c:1.71 Sat Feb 15 20:23:11 2003 +++ php4/sapi/cli/php_cli.c Tue Mar 18 10:56:12 2003 @@ -277,6 +277,28 @@ } +/* {{{ sapi_cli_ini_defaults */ + +#define INI_DEFAULT(name,name_len,value)\ + ZVAL_STRING(tmp, value, 0);\ + zend_hash_update(configuration_hash, name, name_len, tmp, sizeof(zval), (void**)entry);\ + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) + +static void sapi_cli_ini_defaults(HashTable *configuration_hash) +{ + zval *tmp, *entry; + + MAKE_STD_ZVAL(tmp); + + INI_DEFAULT(register_argc_argv, 19, 1); + INI_DEFAULT(html_errors, 12, 1); + INI_DEFAULT(implicit_flush, 15, 1); + INI_DEFAULT(max_execution_time, 19, 0); + + FREE_ZVAL(tmp); +} +/* }}} */ + /* {{{ sapi_module_struct cli_sapi_module */ static sapi_module_struct cli_sapi_module = { @@ -526,6 +548,7 @@ tsrm_startup(1, 1, 0, NULL); #endif + cli_sapi_module.ini_defaults = sapi_cli_ini_defaults; sapi_startup(cli_sapi_module); #ifdef PHP_WIN32 @@ -576,10 +599,6 @@ /* Set some CLI defaults */ SG(options) |= SAPI_OPTION_NO_CHDIR; - zend_alter_ini_entry(register_argc_argv, 19, 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - zend_alter_ini_entry(html_errors, 12, 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - zend_alter_ini_entry(implicit_flush, 15, 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - zend_alter_ini_entry(max_execution_time, 19, 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 18:19 24.03.2003, Moriyoshi Koizumi wrote: Sorry for being a bit late, but this commit broke BC. I cannot override php.ini settings by -d options any more. Hm, not for me. [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
[EMAIL PROTECTED] (Marcus Börger) wrote: At 18:19 24.03.2003, Moriyoshi Koizumi wrote: Sorry for being a bit late, but this commit broke BC. I cannot override php.ini settings by -d options any more. Hm, not for me. [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 Try preparing a ini file that has html_errors directive and doing the same thing with that. Moriyoshi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
Sorry, forget what I just said... But as for mbstring.internal_encoding, it doesn't work as expected. Moriyoshi Moriyoshi Koizumi [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Marcus Börger) wrote: At 18:19 24.03.2003, Moriyoshi Koizumi wrote: Sorry for being a bit late, but this commit broke BC. I cannot override php.ini settings by -d options any more. Hm, not for me. [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 Try preparing a ini file that has html_errors directive and doing the same thing with that. Moriyoshi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 20:11 24.03.2003, Moriyoshi Koizumi wrote: [EMAIL PROTECTED] (Marcus Börger) wrote: At 18:19 24.03.2003, Moriyoshi Koizumi wrote: Sorry for being a bit late, but this commit broke BC. I cannot override php.ini settings by -d options any more. Hm, not for me. [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 Try preparing a ini file that has html_errors directive and doing the same thing with that. There must be something else (i tested all combinations before i committed) but did it again now and here are the results: [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini html_errors = On [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=0 -r 'var_dump(ini_get(html_errors));' string(1) 0 [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini html_errors = Off [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(0) [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=1 -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ grep html_errors ~/php-cli.ini ;html_errors = Off [EMAIL PROTECTED] php4-HEAD]$ php -r 'var_dump(ini_get(html_errors));' string(1) 1 [EMAIL PROTECTED] php4-HEAD]$ php -d html_errors=0 -r 'var_dump(ini_get(html_errors));' string(1) 0 However you reminded me that i must change the default setting. marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Wed Mar 19 15:36:04 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: - reenable $argc/$argv - add a comment where hardcoded defaults would go # i believe we have none for now though Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.73 php4/sapi/cli/php_cli.c:1.74 --- php4/sapi/cli/php_cli.c:1.73Tue Mar 18 15:52:52 2003 +++ php4/sapi/cli/php_cli.c Wed Mar 19 15:36:04 2003 @@ -600,6 +600,8 @@ /* Set some CLI defaults */ SG(options) |= SAPI_OPTION_NO_CHDIR; + /* here is the place for hard coded defaults which cannot be overwritten in the ini file */ + /*zend_alter_ini_entry(name, len, value, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);*/ zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ @@ -894,6 +896,7 @@ } /* This actually destructs the elements of the list - ugly hack */ + zend_is_auto_global(_SERVER, sizeof(_SERVER)-1 TSRMLS_CC); zend_llist_apply(global_vars, (llist_apply_func_t) php_register_command_line_global_vars TSRMLS_CC); zend_llist_destroy(global_vars); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Sat Feb 15 10:20:17 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: fix parameter string (-R -H) Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.69 php4/sapi/cli/php_cli.c:1.70 --- php4/sapi/cli/php_cli.c:1.69Tue Feb 11 15:34:24 2003 +++ php4/sapi/cli/php_cli.c Sat Feb 15 10:20:17 2003 @@ -87,7 +87,7 @@ extern char *ap_php_optarg; extern int ap_php_optind; -#define OPTSTRING aB:Cc:d:E:eF:f:g:hilmnqRH:r:sw?vz +#define OPTSTRING aB:Cc:d:E:eF:f:g:hilmnqR:Hr:sw?vz static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
iliaa Tue Feb 11 11:18:43 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Added -H option to CLI binary. This option can be used to hide any arguments including the script name passed to the CLI binary. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.67 php4/sapi/cli/php_cli.c:1.68 --- php4/sapi/cli/php_cli.c:1.67Fri Feb 7 16:55:51 2003 +++ php4/sapi/cli/php_cli.c Tue Feb 11 11:18:42 2003 @@ -87,7 +87,7 @@ extern char *ap_php_optarg; extern int ap_php_optind; -#define OPTSTRING aB:Cc:d:E:eF:f:g:hilmnqR:r:sw?vz: +#define OPTSTRING aB:Cc:d:E:eF:f:g:hilmnqRH:r:sw?vz static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC) { @@ -317,6 +317,7 @@ -R codeRun PHP code for every input line\n -F fileParse and execute file for every input line\n -E end_codeRun PHP end_code after processing all input lines\n + -H Hide any passed arguments\n -s Display colour syntax highlighted source.\n -v Version number\n -w Display source with stripped comments and whitespace.\n @@ -471,6 +472,7 @@ char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL; const char *param_error=NULL; int scan_input = 0; + int hide_argv = 0; /* end of temporary locals */ #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -780,6 +782,9 @@ case 'z': /* load extension file */ zend_load_extension(ap_php_optarg); break; + case 'H': + hide_argv = 1; + break; default: break; @@ -844,6 +849,14 @@ } CG(start_lineno) = lineno; *arg_excp = arg_free; /* reconstuct argv */ + + if (hide_argv) { + int i; + for (i = 1; i argc; i++) { + memset(argv[i], 0, strlen(argv[i])); + } + } + if (no_headers) { SG(headers_sent) = 1; SG(request_info).no_headers = 1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 17:18 11.02.2003, Ilia Alshanetsky wrote: iliaa Tue Feb 11 11:18:43 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Added -H option to CLI binary. This option can be used to hide any arguments including the script name passed to the CLI binary. Why will i hide command line arguments from command line, does this make sense? @@ -844,6 +849,14 @@ } CG(start_lineno) = lineno; *arg_excp = arg_free; /* reconstuct argv */ + + if (hide_argv) { + int i; + for (i = 1; i argc; i++) { + memset(argv[i], 0, strlen(argv[i])); + } + } + if (no_headers) { SG(headers_sent) = 1; SG(request_info).no_headers = 1; Are you sure this is correct? I mean the variables are registered in php_request_startup(TSRMLS_C)==FAILURE) above your change. And even if it works you shall never ever mess around with the stuff send be main (erm upd i did my self already - but see code above your change). regards marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
On February 11, 2003 02:41 pm, Marcus Börger wrote: Why will i hide command line arguments from command line, does this make sense? This is there primarily for daemon and other long term PHP process that run on shared servers and accept command line arguments. To prevent other users from seeing those arguments you hide them as well as the script name for security reasons (information may be sensitive, full path to configuration file, etc...). The changes take effect after all php work with argv/argc is done so that the real data is avaliable within the PHP script. The only purpose of this code is to hide argv/argc from being visible via the ps command. Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 21:14 11.02.2003, Ilia A. wrote: real data is avaliable within the PHP script. The only purpose of this code is to hide argv/argc from being visible via the ps command. Ilia Ok, now i see the point - that makes sense and indeed a good catch. manpage update follows marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Tue Feb 11 15:34:24 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Make that clear Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.68 php4/sapi/cli/php_cli.c:1.69 --- php4/sapi/cli/php_cli.c:1.68Tue Feb 11 11:18:42 2003 +++ php4/sapi/cli/php_cli.c Tue Feb 11 15:34:24 2003 @@ -317,7 +317,7 @@ -R codeRun PHP code for every input line\n -F fileParse and execute file for every input line\n -E end_codeRun PHP end_code after processing all input lines\n - -H Hide any passed arguments\n + -H Hide any passed arguments from +external tools.\n -s Display colour syntax highlighted source.\n -v Version number\n -w Display source with stripped comments and whitespace.\n -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 15:56 08.02.2003, Jani Taskinen wrote: Just curious..but was there some agreement on keeping these obscure options?? I kinda missed the discussion.. --Jani Some few people were against and Edin liked the idea after playing around with it. So both maintainers of the cli sapi are on the pro side and i went further and made it a round thing. Again i did this to ease use - a thing many guys here are missing. If the discusion starts again and people are against there's no propbelem removing the feature. marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Fri Feb 7 15:53:06 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: No more maximum line size for -R and -F Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.65 php4/sapi/cli/php_cli.c:1.66 --- php4/sapi/cli/php_cli.c:1.65Tue Feb 4 15:52:13 2003 +++ php4/sapi/cli/php_cli.c Fri Feb 7 15:53:05 2003 @@ -901,7 +901,7 @@ case PHP_MODE_PROCESS_STDIN: { - char input[4096]; + char *input; size_t len, index = 0; php_stream_context *sc_in = php_stream_context_alloc(); php_stream *s_in = php_stream_open_wrapper_ex(php://stdin, rb, 0, NULL, sc_in); @@ -915,7 +915,7 @@ Z_LVAL_P(argi) = index; INIT_PZVAL(argi); zend_hash_update(EG(symbol_table), argi, sizeof(argi), argi, sizeof(pval *), NULL); - while (exit_status == SUCCESS php_stream_gets(s_in, input, sizeof(input))) { + while (exit_status == SUCCESS +(input=php_stream_gets(s_in, NULL, 0)) != NULL) { len = strlen(input); while (len-- (input[len]=='\n' || input[len]=='\r')) { input[len] = '\0'; @@ -942,6 +942,7 @@ } } } + efree(input); } if (exec_end zend_eval_string(exec_end, NULL, Command line end code TSRMLS_CC) == FAILURE) { exit_status=254; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Fri Feb 7 16:55:51 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Define STDIN/OUT/ERR for -B -R -F -E (works as expected). Enable exit in same switches. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.66 php4/sapi/cli/php_cli.c:1.67 --- php4/sapi/cli/php_cli.c:1.66Fri Feb 7 15:53:05 2003 +++ php4/sapi/cli/php_cli.c Fri Feb 7 16:55:51 2003 @@ -360,6 +360,9 @@ efree(*arg); } +static php_stream_context *sc_in_process = NULL; +static php_stream *s_in_process = NULL; + static void cli_register_file_handles(TSRMLS_D) { zval *zin, *zout, *zerr; @@ -378,6 +381,9 @@ if (s_in==NULL || s_out==NULL || s_err==NULL) { return; } + + sc_in_process = sc_in; + s_in_process = s_in; php_stream_to_zval(s_in, zin); php_stream_to_zval(s_out, zout); @@ -903,9 +909,9 @@ { char *input; size_t len, index = 0; - php_stream_context *sc_in = php_stream_context_alloc(); - php_stream *s_in = php_stream_open_wrapper_ex(php://stdin, rb, 0, NULL, sc_in); pval *argn, *argi; + + cli_register_file_handles(TSRMLS_C); if (exec_begin zend_eval_string(exec_begin, NULL, Command line begin code TSRMLS_CC) == FAILURE) { exit_status=254; @@ -915,7 +921,7 @@ Z_LVAL_P(argi) = index; INIT_PZVAL(argi); zend_hash_update(EG(symbol_table), argi, sizeof(argi), argi, sizeof(pval *), NULL); - while (exit_status == SUCCESS (input=php_stream_gets(s_in, NULL, 0)) != NULL) { + while (exit_status == SUCCESS +(input=php_stream_gets(s_in_process, NULL, 0)) != NULL) { len = strlen(input); while (len-- (input[len]=='\n' || input[len]=='\r')) { input[len] = '\0'; @@ -948,8 +954,6 @@ exit_status=254; } - php_stream_close(s_in); - php_stream_context_free(sc_in); break; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Tue Feb 4 15:52:13 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: remove it thenthis forces to put work in man page ... Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.64 php4/sapi/cli/php_cli.c:1.65 --- php4/sapi/cli/php_cli.c:1.64Mon Feb 3 02:41:05 2003 +++ php4/sapi/cli/php_cli.c Tue Feb 4 15:52:13 2003 @@ -300,7 +300,7 @@ %s [options] -r code [--] [args...]\n %s [options] [-B begin_code] -R code [-E end_code] [--] [args...]\n %s [options] [-B begin_code] -F file [-E end_code] [--] [args...]\n - %s [options] [--] [args...]\n + %s [options] -- [args...]\n \n -a Run interactively\n -c path|file Look for php.ini file in this directory\n @@ -325,25 +325,6 @@ args... Arguments passed to script. Use -- args when first argument\n starts with - or script is read from stdin\n \n -The PHP Command Line Interface 'CLI' supports the following operation modes:\n -\n - You can parse and execute files by using parameter -f followed by the\n - name of the file to be executed.\n -\n - Using parameter -r you can directly execute PHP code simply as you would\n - do inside a php file when using the eval() function.\n -\n - It is also possible to process the standard input line by line using either\n - the parameter -R or -F. In this mode each separate input line causes the\n - code specified by -R (see -r) or the file specified by -F to be executed.\n - You can access the input line by $argn. While processing the input lines\n - $argi contains the number of the actual line being processed. Further more\n - the paramters -B and -E can be used to execute code (see -r) before and\n - after input line processing respectively.\n -\n - If none of -r -f -B -R -F and -E is present but a single parameter is given\n - then this parameter is taken as the filename to process (same as with -f)\n - If no parameter is present then the standard input is read and executed.\n , prog, prog, prog, prog, prog); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
On Mon, 3 Feb 2003, Marcus Boerger wrote: helly Sun Feb 2 19:22:28 2003 EDT Modified files: /php4/sapi/cliphp_cli.c Log: - Added -B, -F, -R, -E for line by line std in processing. - Added some error messages. - Added more -h info. @Added command line parameters -B, -F, -R and -E which allow to process @stdin line by line (See php -h for more). (marcus) #This allows to simply complex command line constructs... Perhaps some discussion on this in front would have been a good idea. Derick -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
On Mon, 3 Feb 2003, Derick Rethans wrote: On Mon, 3 Feb 2003, Marcus Boerger wrote: helly Sun Feb 2 19:22:28 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: - Added -B, -F, -R, -E for line by line std in processing. - Added some error messages. - Added more -h info. @Added command line parameters -B, -F, -R and -E which allow to process @stdin line by line (See php -h for more). (marcus) #This allows to simply complex command line constructs... Perhaps some discussion on this in front would have been a good idea. I was actually wondering about the same thing. Marcus? Edin -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
On Mon, 03 Feb 2003, Edin Kadribasic wrote: Perhaps some discussion on this in front would have been a good idea. I was actually wondering about the same thing. Marcus? Yeah, no kidding. For a major addition like this sending an RFC to the list would have been a simple courtesy. -Andrei http://www.gravitonic.com/ Remember, high-tech means breaks down next week, while cutting edge means breaks down this afternoon. -- Bruce Sterling -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Sun Feb 2 19:22:28 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: - Added -B, -F, -R, -E for line by line std in processing. - Added some error messages. - Added more -h info. @Added command line parameters -B, -F, -R and -E which allow to process @stdin line by line (See php -h for more). (marcus) #This allows to simply complex command line constructs... Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.62 php4/sapi/cli/php_cli.c:1.63 --- php4/sapi/cli/php_cli.c:1.62Fri Jan 10 19:20:50 2003 +++ php4/sapi/cli/php_cli.c Sun Feb 2 19:22:28 2003 @@ -76,17 +76,18 @@ #include php_getopt.h -#define PHP_MODE_STANDARD1 -#define PHP_MODE_HIGHLIGHT 2 -#define PHP_MODE_INDENT 3 -#define PHP_MODE_LINT4 -#define PHP_MODE_STRIP 5 -#define PHP_MODE_CLI_DIRECT 6 +#define PHP_MODE_STANDARD 1 +#define PHP_MODE_HIGHLIGHT 2 +#define PHP_MODE_INDENT3 +#define PHP_MODE_LINT 4 +#define PHP_MODE_STRIP 5 +#define PHP_MODE_CLI_DIRECT6 +#define PHP_MODE_PROCESS_STDIN 7 extern char *ap_php_optarg; extern int ap_php_optind; -#define OPTSTRING aCc:d:ef:g:hilmnqr:sw?vz: +#define OPTSTRING aB:Cc:d:E:eF:f:g:hilmnqR:r:sw?vz: static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC) { @@ -295,9 +296,12 @@ prog = php; } - php_printf( Usage: %s [options] [-f] file [args...]\n - %s [options] -r code [args...]\n - %s [options] [-- args...]\n + php_printf( Usage: %s [options] [-f] file [--] [args...]\n + %s [options] -r code [--] [args...]\n + %s [options] [-B begin_code] -R code [-E end_code] +[--] [args...]\n + %s [options] [-B begin_code] -F file [-E end_code] +[--] [args...]\n + %s [options] [--] [args...]\n + \n -a Run interactively\n -c path|file Look for php.ini file in this directory\n -n No php.ini file will be used\n @@ -309,14 +313,38 @@ -l Syntax check only (lint)\n -m Show compiled in modules\n -r codeRun PHP code without using script tags ?..?\n + -B begin_code Run PHP begin_code before +processing input lines\n + -R codeRun PHP code for every input +line\n + -F fileParse and execute file for every +input line\n + -E end_codeRun PHP end_code after +processing all input lines\n -s Display colour syntax highlighted source.\n -v Version number\n -w Display source with stripped comments and whitespace.\n -z fileLoad Zend extension file.\n \n - args... Arguments passed to script. Use -- args when first argument \n + args... Arguments passed to script. Use -- +args when first argument\n starts with - or script is read from stdin\n - , prog, prog, prog); + \n +The PHP Command Line Interface 'CLI' supports the following operation modes:\n +\n + You can parse and execute files by using parameter -f followed by the\n + name of the file to be executed.\n +\n + Using parameter -r you can directly execute PHP code simply as you would\n + do inside a php file when using the eval() function.\n +\n + It is also possible to process the standard input line by line using either\n + the parameter -R or -F. In this mode each separate input line causes the\n + code specified by -R (see -r) or the file specified by -F to be executed.\n + You can access the input line by $argn. While processing the input lines\n + $argi contains the number of the actual line being processed. Further more\n + the paramters -B and -E can be used to execute code (see -r) before and\n + after input line processing respectively.\n +\n + If none of -r -f -B -R -F and -E is present but a single parameter is given\n + then this parameter is taken as the filename to process (same as with -f)\n + If no parameter is present then the standard input is read and executed.\n + , prog, prog, prog, prog, prog); } /* }}} */ @@ -397,6 +425,44 @@ FREE_ZVAL(zerr); } +static const char *param_mode_conflict =
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
sebastian Mon Feb 3 02:41:06 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix ZTS build. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.63 php4/sapi/cli/php_cli.c:1.64 --- php4/sapi/cli/php_cli.c:1.63Sun Feb 2 19:22:28 2003 +++ php4/sapi/cli/php_cli.c Mon Feb 3 02:41:05 2003 @@ -429,7 +429,7 @@ /* {{{ cli_seek_file_begin */ -static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno) +static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int +*lineno TSRMLS_DC) { int c; @@ -820,7 +820,7 @@ ap_php_optind++; } if (script_file) { - if (cli_seek_file_begin(file_handle, script_file, lineno) != SUCCESS) { + if (cli_seek_file_begin(file_handle, script_file, lineno +TSRMLS_CC) != SUCCESS) { goto err; } script_filename = script_file; @@ -952,7 +952,7 @@ } } else { if (script_file) { - if (cli_seek_file_begin(file_handle, script_file, lineno) != SUCCESS) { + if +(cli_seek_file_begin(file_handle, script_file, lineno TSRMLS_CC) != SUCCESS) { exit_status = 1; } else { CG(start_lineno) = lineno; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
At 08:41 03.02.2003, Sebastian Bergmann wrote: sebastian Mon Feb 3 02:41:06 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix ZTS build. Thanks, i was sure i did latest changes before commit with a ZTS version...but it seems i have to many php source directories. marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
iliaa Fri Jan 10 19:20:50 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix the line numbering when the 1st line in the script is #!. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.61 php4/sapi/cli/php_cli.c:1.62 --- php4/sapi/cli/php_cli.c:1.61Tue Jan 7 19:41:53 2003 +++ php4/sapi/cli/php_cli.c Fri Jan 10 19:20:50 2003 @@ -414,6 +414,7 @@ zend_llist global_vars; int interactive=0; int module_started = 0; + int lineno = 0; char *exec_direct=NULL; char *param_error=NULL; /* end of temporary locals */ @@ -702,7 +703,7 @@ fseek(file_handle.handle.fp, pos - 1, SEEK_SET); } } - CG(start_lineno) = 2; + lineno = 2; } else { rewind(file_handle.handle.fp); } @@ -733,6 +734,7 @@ PUTS(Could not startup.\n); goto err; } + CG(start_lineno) = lineno; *arg_excp = arg_free; /* reconstuct argv */ if (no_headers) { SG(headers_sent) = 1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
edink Wed Dec 18 19:13:43 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: MFB: Reverted previous patches as suggested by Andi. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.56 php4/sapi/cli/php_cli.c:1.57 --- php4/sapi/cli/php_cli.c:1.56Wed Dec 11 05:24:02 2002 +++ php4/sapi/cli/php_cli.c Wed Dec 18 19:13:43 2002 @@ -375,19 +375,22 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - ic.flags = CONST_CS; + zval_copy_ctor(ic.value); + ic.flags = CONST_CS | CONST_PERSISTENT; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - oc.flags = CONST_CS; + zval_copy_ctor(oc.value); + oc.flags = CONST_CS | CONST_PERSISTENT; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - ec.flags = CONST_CS; + zval_copy_ctor(ec.value); + ec.flags = CONST_CS | CONST_PERSISTENT; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; zend_register_constant(ec TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
I didn't understand the explanation. Why do you mind if the resources are destroyed before the constants? That's good, no? Andi At 03:22 PM 12/15/2002 +0900, Moriyoshi Koizumi wrote: It appears that the problem was because stream resources are finalized before the constants that contain those resources are destructed, as php_stream_open_wrapper_ex() doesn't return persistent resources. Moriyoshi Andi Gutmans [EMAIL PROTECTED] wrote: This doesn't look right to me. We always use CONST_PERSISTENT in all of PHP. What is the problem? Andi At 10:24 AM 12/11/2002 +, Edin Kadribasic wrote: edink Wed Dec 11 05:24:03 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix for #20539 (patch by Moriyoshi Koizumi). Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.55 php4/sapi/cli/php_cli.c:1.56 --- php4/sapi/cli/php_cli.c:1.55Mon Dec 9 06:45:46 2002 +++ php4/sapi/cli/php_cli.c Wed Dec 11 05:24:02 2002 @@ -375,19 +375,19 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - ic.flags = CONST_CS | CONST_PERSISTENT; + ic.flags = CONST_CS; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - oc.flags = CONST_CS | CONST_PERSISTENT; + oc.flags = CONST_CS; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - ec.flags = CONST_CS | CONST_PERSISTENT; + ec.flags = CONST_CS; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; zend_register_constant(ec TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
This doesn't look right to me. We always use CONST_PERSISTENT in all of PHP. What is the problem? Andi At 10:24 AM 12/11/2002 +, Edin Kadribasic wrote: edink Wed Dec 11 05:24:03 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix for #20539 (patch by Moriyoshi Koizumi). Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.55 php4/sapi/cli/php_cli.c:1.56 --- php4/sapi/cli/php_cli.c:1.55Mon Dec 9 06:45:46 2002 +++ php4/sapi/cli/php_cli.c Wed Dec 11 05:24:02 2002 @@ -375,19 +375,19 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - ic.flags = CONST_CS | CONST_PERSISTENT; + ic.flags = CONST_CS; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - oc.flags = CONST_CS | CONST_PERSISTENT; + oc.flags = CONST_CS; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - ec.flags = CONST_CS | CONST_PERSISTENT; + ec.flags = CONST_CS; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; zend_register_constant(ec TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /sapi/cli php_cli.c
It appears that the problem was because stream resources are finalized before the constants that contain those resources are destructed, as php_stream_open_wrapper_ex() doesn't return persistent resources. Moriyoshi Andi Gutmans [EMAIL PROTECTED] wrote: This doesn't look right to me. We always use CONST_PERSISTENT in all of PHP. What is the problem? Andi At 10:24 AM 12/11/2002 +, Edin Kadribasic wrote: edink Wed Dec 11 05:24:03 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix for #20539 (patch by Moriyoshi Koizumi). Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.55 php4/sapi/cli/php_cli.c:1.56 --- php4/sapi/cli/php_cli.c:1.55Mon Dec 9 06:45:46 2002 +++ php4/sapi/cli/php_cli.c Wed Dec 11 05:24:02 2002 @@ -375,19 +375,19 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - ic.flags = CONST_CS | CONST_PERSISTENT; + ic.flags = CONST_CS; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - oc.flags = CONST_CS | CONST_PERSISTENT; + oc.flags = CONST_CS; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - ec.flags = CONST_CS | CONST_PERSISTENT; + ec.flags = CONST_CS; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; zend_register_constant(ec TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
edink Wed Dec 11 05:24:03 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix for #20539 (patch by Moriyoshi Koizumi). Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.55 php4/sapi/cli/php_cli.c:1.56 --- php4/sapi/cli/php_cli.c:1.55Mon Dec 9 06:45:46 2002 +++ php4/sapi/cli/php_cli.c Wed Dec 11 05:24:02 2002 @@ -375,19 +375,19 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - ic.flags = CONST_CS | CONST_PERSISTENT; + ic.flags = CONST_CS; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - oc.flags = CONST_CS | CONST_PERSISTENT; + oc.flags = CONST_CS; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - ec.flags = CONST_CS | CONST_PERSISTENT; + ec.flags = CONST_CS; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; zend_register_constant(ec TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
sebastian Mon Dec 9 06:45:47 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fix build. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.54 php4/sapi/cli/php_cli.c:1.55 --- php4/sapi/cli/php_cli.c:1.54Sun Dec 8 05:23:50 2002 +++ php4/sapi/cli/php_cli.c Mon Dec 9 06:45:46 2002 @@ -23,6 +23,7 @@ #include php.h #include php_globals.h #include php_variables.h +#include zend_hash.h #include zend_modules.h #include SAPI.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
moriyoshi Sun Dec 8 05:23:51 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fixed stream leaks Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.53 php4/sapi/cli/php_cli.c:1.54 --- php4/sapi/cli/php_cli.c:1.53Tue Nov 26 00:57:03 2002 +++ php4/sapi/cli/php_cli.c Sun Dec 8 05:23:50 2002 @@ -374,21 +374,18 @@ php_stream_to_zval(s_err, zerr); ic.value = *zin; - zval_copy_ctor(ic.value); ic.flags = CONST_CS | CONST_PERSISTENT; ic.name = zend_strndup(STDIN, 6); ic.name_len = 6; zend_register_constant(ic TSRMLS_CC); oc.value = *zout; - zval_copy_ctor(oc.value); oc.flags = CONST_CS | CONST_PERSISTENT; oc.name = zend_strndup(STDOUT, 7); oc.name_len = 7; zend_register_constant(oc TSRMLS_CC); ec.value = *zerr; - zval_copy_ctor(ec.value); ec.flags = CONST_CS | CONST_PERSISTENT; ec.name = zend_strndup(STDERR, 7); ec.name_len = 7; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
edink Tue Nov 5 06:13:35 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Made php -v output look nicer on standard 80 column display. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.46 php4/sapi/cli/php_cli.c:1.47 --- php4/sapi/cli/php_cli.c:1.46Thu Oct 31 12:34:10 2002 +++ php4/sapi/cli/php_cli.c Tue Nov 5 06:13:35 2002 -594,7 +594,7 SG(headers_sent) = 1; SG(request_info).no_headers = 1; } - php_printf(PHP %s (%s) (built: %s %s), Copyright (c) 1997-2002 The PHP Group\n%s, PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_printf(PHP %s (%s) (built: %s %s)\nCopyright (c) +1997-2002 The PHP Group\n%s, PHP_VERSION, sapi_module.name, __DATE__, __TIME__, +get_zend_version()); php_end_ob_buffers(1 TSRMLS_CC); exit(1); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
helly Tue Nov 5 10:15:51 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: call php_module_startup after zts has been initialised. This way we could have called zend_ini_deactivate(TSRMLS_C). But it seems unnecessary. #tested with ZTS and non ZTS build and many manual fail points. #now it even compiles without any warning, at least for me Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.47 php4/sapi/cli/php_cli.c:1.48 --- php4/sapi/cli/php_cli.c:1.47Tue Nov 5 06:13:35 2002 +++ php4/sapi/cli/php_cli.c Tue Nov 5 10:15:51 2002 -431,12 +431,6 cli_sapi_module.executable_location = argv[0]; - /* startup after we get the above ini override se we get things right */ - if (php_module_startup(cli_sapi_module, NULL, 0)==FAILURE) { - goto err; - } - module_started = 1; - #ifdef ZTS compiler_globals = ts_resource(compiler_globals_id); executor_globals = ts_resource(executor_globals_id); -444,6 +438,18 sapi_globals = ts_resource(sapi_globals_id); tsrm_ls = ts_resource(0); #endif + + /* startup after we get the above ini override se we get things right */ + if (php_module_startup(cli_sapi_module, NULL, 0)==FAILURE) { + /* there is no way to see if we must call zend_ini_deactivate() +* since we cannot check if EG(ini_directives) has been initialised +* because the executor's constructor does not set initialize it. +* Apart from that there seems no need for zend_ini_deactivate() yet. +* So we goto out_err.*/ + exit_status = 1; + goto out_err; + } + module_started = 1; zend_first_try { while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
sniper Thu Oct 31 12:34:10 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Added built date and time to -v output. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.45 php4/sapi/cli/php_cli.c:1.46 --- php4/sapi/cli/php_cli.c:1.45Sat Oct 26 15:33:15 2002 +++ php4/sapi/cli/php_cli.c Thu Oct 31 12:34:10 2002 -594,7 +594,7 SG(headers_sent) = 1; SG(request_info).no_headers = 1; } - php_printf(PHP %s (%s), Copyright (c) 1997-2002 The PHP Group\n%s, PHP_VERSION, sapi_module.name, get_zend_version()); + php_printf(PHP %s (%s) (built: %s %s), Copyright (c) +1997-2002 The PHP Group\n%s, PHP_VERSION, sapi_module.name, __DATE__, __TIME__, +get_zend_version()); php_end_ob_buffers(1 TSRMLS_CC); exit(1); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
iliaa Sat Oct 26 15:33:15 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: Fixed memory leaks. Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.44 php4/sapi/cli/php_cli.c:1.45 --- php4/sapi/cli/php_cli.c:1.44Fri Oct 25 05:32:32 2002 +++ php4/sapi/cli/php_cli.c Sat Oct 26 15:33:15 2002 -740,8 +740,6 break; } - php_request_shutdown((void *) 0); - if (cli_sapi_module.php_ini_path_override) { free(cli_sapi_module.php_ini_path_override); } -751,6 +749,8 } zend_end_try(); out: + php_request_shutdown((void *) 0); +out_err: if (module_started) { php_module_shutdown(TSRMLS_C); } -762,8 +762,9 exit(exit_status); err: + zend_ini_deactivate(TSRMLS_C); exit_status = 1; - goto out; + goto out_err; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
jan Fri Oct 25 05:32:34 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: - alphabetical output for php -h (cli) Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.43 php4/sapi/cli/php_cli.c:1.44 --- php4/sapi/cli/php_cli.c:1.43Thu Oct 24 12:04:31 2002 +++ php4/sapi/cli/php_cli.c Fri Oct 25 05:32:32 2002 -262,20 +262,20 php_printf( Usage: %s [options] [-f] file [args...]\n %s [options] -r code [args...]\n %s [options] [-- args...]\n - -s Display colour syntax highlighted source.\n - -w Display source with stripped comments and whitespace.\n - -f fileParse file.\n - -v Version number\n - -c path|file Look for php.ini file in this directory\n -a Run interactively\n + -c path|file Look for php.ini file in this +directory\n -d foo[=bar] Define INI entry foo with value 'bar'\n -e Generate extended information for debugger/profiler\n - -z fileLoad Zend extension file.\n + -f fileParse file.\n + -h This help\n + -i PHP information\n -l Syntax check only (lint)\n -m Show compiled in modules\n - -i PHP information\n -r codeRun PHP code without using script tags ?..?\n - -h This help\n + -s Display colour syntax highlighted +source.\n + -v Version number\n + -w Display source with stripped +comments and whitespace.\n + -z fileLoad Zend extension file.\n \n args... Arguments passed to script. Use -- args when first argument \n starts with - or script is read from stdin\n -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /sapi/cli php_cli.c
derick Thu Oct 24 10:01:40 2002 EDT Modified files: /php4/sapi/cli php_cli.c Log: - whitespace Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.41 php4/sapi/cli/php_cli.c:1.42 --- php4/sapi/cli/php_cli.c:1.41Thu Oct 24 09:25:57 2002 +++ php4/sapi/cli/php_cli.c Thu Oct 24 10:01:39 2002 -109,7 +109,9 long ret; ret = write(STDOUT_FILENO, str, str_length); - if (ret = 0) return 0; + if (ret = 0) { + return 0; + } return ret; #else size_t ret; -748,8 +750,9 } zend_end_try(); out: - if (module_started) + if (module_started) { php_module_shutdown(TSRMLS_C); + } sapi_shutdown(); #ifdef ZTS tsrm_shutdown(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php