Hello Jani,
I did some experiments with b) and I would indeed ignore everything
that is configured out. I'll send you a patch as soon as I have somethign
that works. For getting the variables into the configuratrion hash prior to
parsing the INI I can send you the patch tonight if you care how I did that
part.
marcus
Monday, February 4, 2008, 12:43:18 PM, you wrote:
> a) requires that certain constants are defined prior to parse happens
> (I have patch for that waiting for commit already)
> b) Also requires the patch for constants but also a lot more
> modifications to the parser. I've been working on adding the if..else
> stuff but haven't had much time lately.
> It would be neat to have both a) and b). But the syntax for b)
> should be something else. And it should be parse-time thing, not execute
> time. ie. The scanner/parser should only add the "true" block into
> config hash. I had this syntax in mind:
> #if expr
> #elseif expr
> #endif
> Similar syntax with CPP.. :)
> --Jani
> On Mon, 2008-02-04 at 12:27 +0100, Marcus Boerger wrote:
>> Hello Jani,
>>
>> I am trying to add stuff to configuration hash prior to calling the ini
>> parser and then somehow allowing the parser for instance to act on the
>> version of php, whether it is a debug build, and whether it is a zts build.
>> That way I could have one config that loads the correct xdebug extension on
>> my development machine. I see two possibilities here:
>> a) zend_extension${php.debug?_debug:}${php.zts?_zts:} =
>> /usr/src/${php.tag}/ext/xdebug/xdebug.so
>> b)
>> [IF ${php.debug} && ${php.zts}]
>> zend_extension_debug_zts = /usr/src/${php.tag}/ext/xdebug/xdebug.so
>> [ELIF ${php.debug}]
>> zend_extension_debug = /usr/src/${php.tag}/ext/xdebug/xdebug.so
>> [ELIF ${php.zts}]
>> zend_extension_zts = /usr/src/${php.tag}/ext/xdebug/xdebug.so
>> [ELSE]
>> zend_extension_zts = /usr/src/${php.tag}/ext/xdebug/xdebug.so
>> [ENDIF]
>>
>> Monday, February 4, 2008, 11:54:00 AM, you wrote:
>>
>> > Like what stuff? :)
>>
>> > --Jani
>>
>> > On Mon, 2008-02-04 at 11:40 +0100, Marcus Boerger wrote:
>> >> Hello Jani,
>> >>
>> >> for the moment probably only ofr me. But I am working on more stuff.
>> >>
>> >> marcus
>> >>
>> >> Monday, February 4, 2008, 10:28:09 AM, you wrote:
>> >>
>> >> > This function was actually just for debugging. I didn't include it in by
>> >> > default since I don't think it has much value to the end users..:)
>> >> > Did you find some real usage for it?
>> >>
>> >> > --Jani
>> >>
>> >> > On Sun, 2008-02-03 at 14:35 +0000, Marcus Boerger wrote:
>> >> >> helly Sun Feb 3 14:35:29 2008 UTC
>> >> >>
>> >> >> Modified files:
>> >> >> /php-src/ext/standard basic_functions.c basic_functions.h
>> >> >> /php-src/main php_ini.c php_ini.h
>> >> >> Log:
>> >> >> - Rename dump_config_hash() to get_config_hash() as it doesn't dump
>> >> >>
>> >> >> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.887&r2=1.888&diff_format=u
>> >> >> Index: php-src/ext/standard/basic_functions.c
>> >> >> diff -u php-src/ext/standard/basic_functions.c:1.887
>> >> >> php-src/ext/standard/basic_functions.c:1.888
>> >> >> --- php-src/ext/standard/basic_functions.c:1.887 Sat Jan 19
>> >> >> 19:23:25 2008
>> >> >> +++ php-src/ext/standard/basic_functions.c Sun Feb 3 14:35:29 2008
>> >> >> @@ -17,7 +17,7 @@
>> >> >>
>> >> >> +----------------------------------------------------------------------+
>> >> >> */
>> >> >>
>> >> >> -/* $Id: basic_functions.c,v 1.887 2008/01/19 19:23:25 davidc Exp $ */
>> >> >> +/* $Id: basic_functions.c,v 1.888 2008/02/03 14:35:29 helly Exp $ */
>> >> >>
>> >> >> #include "php.h"
>> >> >> #include "php_streams.h"
>> >> >> @@ -943,11 +943,9 @@
>> >> >> ZEND_ARG_INFO(0, scanner_mode)
>> >> >> ZEND_END_ARG_INFO()
>> >> >>
>> >> >> -#if ZEND_DEBUG
>> >> >> static
>> >> >> -ZEND_BEGIN_ARG_INFO(arginfo_dump_config_hash, 0)
>> >> >> +ZEND_BEGIN_ARG_INFO(arginfo_get_config_hash, 0)
>> >> >> ZEND_END_ARG_INFO()
>> >> >> -#endif
>> >> >>
>> >> >> static
>> >> >> ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1)
>> >> >> @@ -3439,9 +3437,7 @@
>> >> >> PHP_FE(connection_status,
>> >> >>
>> >> >> arginfo_connection_status)
>> >> >> PHP_FE(ignore_user_abort,
>> >> >>
>> >> >> arginfo_ignore_user_abort)
>> >> >> PHP_FE(parse_ini_file,
>> >> >>
>> >> >> arginfo_parse_ini_file)
>> >> >> -#if ZEND_DEBUG
>> >> >> - PHP_FE(dump_config_hash,
>> >> >>
>> >> >> arginfo_dump_config_hash)
>> >> >> -#endif
>> >> >> + PHP_FE(get_config_hash,
>> >> >>
>> >> >> arginfo_get_config_hash)
>> >> >> PHP_FE(is_uploaded_file,
>> >> >>
>> >> >> arginfo_is_uploaded_file)
>> >> >> PHP_FE(move_uploaded_file,
>> >> >>
>> >> >> arginfo_move_uploaded_file)
>> >> >>
>> >> >> @@ -6340,18 +6336,16 @@
>> >> >> }
>> >> >> /* }}} */
>> >> >>
>> >> >> -#if ZEND_DEBUG
>> >> >> -/* {{{ proto void dump_config_hash(void)
>> >> >> +/* {{{ proto array get_config_hash(void)
>> >> >> */
>> >> >> -PHP_FUNCTION(dump_config_hash)
>> >> >> +PHP_FUNCTION(get_config_hash)
>> >> >> {
>> >> >> - HashTable hash = get_configuration_hash();
>> >> >> + HashTable *hash = php_ini_get_configuration_hash();
>> >> >>
>> >> >> array_init(return_value);
>> >> >> - zend_hash_apply_with_arguments(&hash, (apply_func_args_t)
>> >> >> add_config_entry_cb, 1, return_value
>> >> >> TSRMLS_CC);
>> >> >> + zend_hash_apply_with_arguments(hash, (apply_func_args_t)
>> >> >> add_config_entry_cb, 1, return_value
>> >> >> TSRMLS_CC);
>> >> >> }
>> >> >> /* }}} */
>> >> >> -#endif
>> >> >>
>> >> >> static int copy_request_variable(void *pDest, int num_args, va_list
>> >> >> args, zend_hash_key *hash_key) /*
>> >> {{{ */
>> >> >> {
>> >> >> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.h?r1=1.159&r2=1.160&diff_format=u
>> >> >> Index: php-src/ext/standard/basic_functions.h
>> >> >> diff -u php-src/ext/standard/basic_functions.h:1.159
>> >> >> php-src/ext/standard/basic_functions.h:1.160
>> >> >> --- php-src/ext/standard/basic_functions.h:1.159 Mon Dec 31
>> >> >> 07:12:15 2007
>> >> >> +++ php-src/ext/standard/basic_functions.h Sun Feb 3 14:35:29 2008
>> >> >> @@ -17,7 +17,7 @@
>> >> >>
>> >> >> +----------------------------------------------------------------------+
>> >> >> */
>> >> >>
>> >> >> -/* $Id: basic_functions.h,v 1.159 2007/12/31 07:12:15 sebastian Exp $
>> >> >> */
>> >> >> +/* $Id: basic_functions.h,v 1.160 2008/02/03 14:35:29 helly Exp $ */
>> >> >>
>> >> >> #ifndef BASIC_FUNCTIONS_H
>> >> >> #define BASIC_FUNCTIONS_H
>> >> >> @@ -125,9 +125,7 @@
>> >> >>
>> >> >> /* From the INI parser */
>> >> >> PHP_FUNCTION(parse_ini_file);
>> >> >> -#if ZEND_DEBUG
>> >> >> PHP_FUNCTION(dump_config_hash);
>> >> >> -#endif
>> >> >>
>> >> >> PHP_FUNCTION(str_rot13);
>> >> >> PHP_FUNCTION(stream_get_filters);
>> >> >> http://cvs.php.net/viewvc.cgi/php-src/main/php_ini.c?r1=1.164&r2=1.165&diff_format=u
>> >> >> Index: php-src/main/php_ini.c
>> >> >> diff -u php-src/main/php_ini.c:1.164 php-src/main/php_ini.c:1.165
>> >> >> --- php-src/main/php_ini.c:1.164 Mon Dec 31 07:12:18 2007
>> >> >> +++ php-src/main/php_ini.c Sun Feb 3 14:35:29 2008
>> >> >> @@ -16,7 +16,7 @@
>> >> >>
>> >> >> +----------------------------------------------------------------------+
>> >> >> */
>> >> >>
>> >> >> -/* $Id: php_ini.c,v 1.164 2007/12/31 07:12:18 sebastian Exp $ */
>> >> >> +/* $Id: php_ini.c,v 1.165 2008/02/03 14:35:29 helly Exp $ */
>> >> >>
>> >> >> #include "php.h"
>> >> >> #include "ext/standard/info.h"
>> >> >> @@ -836,13 +836,10 @@
>> >> >> }
>> >> >> /* }}} */
>> >> >>
>> >> >> -#if ZEND_DEBUG
>> >> >> -#include "php_ini.h"
>> >> >> -PHPAPI HashTable get_configuration_hash(void)
>> >> >> +PHPAPI HashTable* php_ini_get_configuration_hash(void) /* {{{ */
>> >> >> {
>> >> >> - return configuration_hash;
>> >> >> -}
>> >> >> -#endif
>> >> >> + return &configuration_hash;
>> >> >> +} /* }}} */
>> >> >>
>> >> >> /*
>> >> >> * Local variables:
>> >> >> http://cvs.php.net/viewvc.cgi/php-src/main/php_ini.h?r1=1.55&r2=1.56&diff_format=u
>> >> >> Index: php-src/main/php_ini.h
>> >> >> diff -u php-src/main/php_ini.h:1.55 php-src/main/php_ini.h:1.56
>> >> >> --- php-src/main/php_ini.h:1.55 Mon Dec 31 07:12:18 2007
>> >> >> +++ php-src/main/php_ini.h Sun Feb 3 14:35:29 2008
>> >> >> @@ -16,7 +16,7 @@
>> >> >>
>> >> >> +----------------------------------------------------------------------+
>> >> >> */
>> >> >>
>> >> >> -/* $Id: php_ini.h,v 1.55 2007/12/31 07:12:18 sebastian Exp $ */
>> >> >> +/* $Id: php_ini.h,v 1.56 2008/02/03 14:35:29 helly Exp $ */
>> >> >>
>> >> >> #ifndef PHP_INI_H
>> >> >> #define PHP_INI_H
>> >> >> @@ -36,9 +36,7 @@
>> >> >> PHPAPI void php_ini_activate_config(HashTable *source_hash, int
>> >> >> modify_type, int stage TSRMLS_DC);
>> >> >> PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len
>> >> >> TSRMLS_DC);
>> >> >> PHPAPI void php_ini_activate_per_host_config(char *host, uint
>> >> >> host_len TSRMLS_DC);
>> >> >> -#if ZEND_DEBUG
>> >> >> -PHPAPI HashTable get_configuration_hash(void);
>> >> >> -#endif
>> >> >> +PHPAPI HashTable* php_in_get_configuration_hash(void);
>> >> >> END_EXTERN_C()
>> >> >>
>> >> >> #define PHP_INI_USER ZEND_INI_USER
>> >> >>
>> >> > --
>> >> > Patches/Donations: http://pecl.php.net/~jani/
>> >>
>> >>
>> >>
>> >>
>> >> Best regards,
>> >> Marcus
>> >>
>>
>>
>>
>> Best regards,
>> Marcus
>>
Best regards,
Marcus
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php