Re: [PHP-DEV] Re: INI defaults for CLI

2003-03-03 Thread Marcus Börger
At 02:45 03.03.2003, [EMAIL PROTECTED] wrote:
Nothing attached...


Try again...
Index: main/SAPI.h
===
RCS file: /repository/php4/main/SAPI.h,v
retrieving revision 1.100
diff -u -r1.100 SAPI.h
--- main/SAPI.h 20 Feb 2003 22:21:48 -  1.100
+++ main/SAPI.h 3 Mar 2003 00:13:21 -
@@ -241,6 +241,8 @@
int (*get_target_gid)(gid_t * TSRMLS_DC);
 
unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int 
val_len TSRMLS_DC);
+   
+   void (*ini_defaults)(HashTable *configuration_hash);
 };
 
 
Index: main/php_ini.c
===
RCS file: /repository/php4/main/php_ini.c,v
retrieving revision 1.117
diff -u -r1.117 php_ini.c
--- main/php_ini.c  28 Feb 2003 20:48:38 -  1.117
+++ main/php_ini.c  3 Mar 2003 00:13:21 -
@@ -276,6 +276,10 @@
return FAILURE;
}
 
+   if (sapi_module.ini_defaults) {
+   sapi_module.ini_defaults(configuration_hash);
+   }
+
zend_llist_init(extension_lists.engine, sizeof(char *), (llist_dtor_func_t) 
free_estring, 1);
zend_llist_init(extension_lists.functions, sizeof(zval), (llist_dtor_func_t)  
ZVAL_DESTRUCTOR, 1);
zend_llist_init(scanned_ini_list, sizeof(char *), (llist_dtor_func_t) 
free_estring, 1);
Index: sapi/cli/php_cli.c
===
RCS file: /repository/php4/sapi/cli/php_cli.c,v
retrieving revision 1.71
diff -u -r1.71 php_cli.c
--- sapi/cli/php_cli.c  16 Feb 2003 01:23:11 -  1.71
+++ sapi/cli/php_cli.c  3 Mar 2003 00:13:21 -
@@ -277,6 +277,29 @@
 }
 
 
+/* {{{ 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(register_long_arrays, 21, 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 +549,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 +600,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 Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: INI defaults for CLI

2003-03-03 Thread Edin Kadribasic
Hi Marcus,

This patch looks fine to me, but I have the same reservations as you in 
that I'm not sure if we really need to modify the current behavior.

IIRC it was Markus who objected to the way CLI overrode some default 
ini settings in a way that php.ini entries were ignored. You could 
still change them with -d command line switch.

I'm sort of +0.5 for applying this patch if no other objections 
surface. If it gets applied we're probably best of commenting out 
relevant php.ini-dist and php.ini-recommended entries and noting in the 
commend what are defaults.

Edin



On Monday, Mar 3, 2003, at 11:40 Europe/Copenhagen, Marcus Börger wrote:

At 02:45 03.03.2003, [EMAIL PROTECTED] wrote:
Nothing attached...


Try again...
20030303-1.diff.txt
--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] Re: INI defaults for CLI

2003-03-02 Thread nicos
Nothing attached...

--
Regards.
M.CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com Hébergement de sites internets.

Marcus Börger [EMAIL PROTECTED] a écrit dans le message de
news: [EMAIL PROTECTED]
Hi,

the current implementation does not allow to overwrite the hard
coded INI defaults of CLI (See ToDo).

The attached patch does allow it. However i am not sure if we want
this. I mean the problem is that a user might copy/use his normal
php.ini file and overwrite the cli defaults and gets unexpected behavior
and then writes a bug...

regards
marcus


--
--
Marcus Börger - Looking for all sorts of freelance work - just ask...

Did i help you? Consider a gift:
http://www.amazon.de/exec/obidos/wishlist/ho722v0rg1u0
--




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php