diff options
author | Dmitry Stogov <dmitry@php.net> | 2006-09-19 20:33:12 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2006-09-19 20:33:12 +0000 |
commit | 7d14dad02ea58db34594e91f759424c51071c5a8 (patch) | |
tree | 95a32d750a5c9b0e626bfbe4d02ebd5f4609a53b /Zend/zend_ini_parser.y | |
parent | 2332e4f9fc134b2ddec3779bcaf1ea237631b7c2 (diff) | |
download | php-git-7d14dad02ea58db34594e91f759424c51071c5a8.tar.gz |
MFH: Fixed mess with CGI/CLI -d command line option (now it works with cgi; constants are working exactly like in php.ini; with FastCGI -d affects all requests).
Diffstat (limited to 'Zend/zend_ini_parser.y')
-rw-r--r-- | Zend/zend_ini_parser.y | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 244673dba6..9346acfda7 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -157,10 +157,14 @@ static void ini_error(char *str) TSRMLS_FETCH(); currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); - error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ - error_buf = (char *) emalloc(error_buf_len); + if (currently_parsed_filename) { + error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ + error_buf = (char *) emalloc(error_buf_len); - sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + } else { + error_buf = estrdup("Invalid configuration directive\n"); + } if (CG(ini_parser_unbuffered_errors)) { #ifdef PHP_WIN32 @@ -202,6 +206,29 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro } +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +{ + zend_ini_parser_param ini_parser_param; + TSRMLS_FETCH(); + + ini_parser_param.ini_parser_cb = ini_parser_cb; + ini_parser_param.arg = arg; + + CG(ini_parser_param) = &ini_parser_param; + if (zend_ini_prepare_string_for_scanning(str TSRMLS_CC)==FAILURE) { + return FAILURE; + } + + CG(ini_parser_unbuffered_errors) = unbuffered_errors; + + if (ini_parse(TSRMLS_C)) { + return SUCCESS; + } else { + return FAILURE; + } +} + + %} %pure_parser |