Re: [PHP-DOC] [PATCH] Restructuring built-in variables
On 14 Apr 2008, at 11:10, Hannes Magnusson wrote: On Mon, Apr 14, 2008 at 7:32 PM, Philip Olson <[EMAIL PROTECTED]> wrote: On 13 Apr 2008, at 08:01, Daniel Convissor wrote: Hi Hannes: The idea is to first refactor it with minimum changes so translators don't have to retranslate the entire thing again. Then after the commit it is easy to make any further adjustments, but yeah. That should be noted. Yeah. Was thinking the same thing. Thanks for the the fixes, and of course the whole reworking. This is a great change to the docs, except the first page looks odd with "Superglobals" essentially being listed twice. Moving that part to its own little section seems like a good choice. You mean splitting the page in two s, one for superglobals and one for "others"? I agree, it feels a bit weird looking at it at first sight, but the TOC contains all predefined-variables, not only superglobals... I mean have a page that talks about what superglobals are, and it'd include that superglobals list. So basically this means move language.variables.superglobals outside of the partintro in variables.xml to a new page like variables/superglobals.xml even though superglobals isn't a variable itself. variables.xml would then include it on top of the others. And as a side effect, we could move information that clutters up each superglobal page into it... information that although relevant could be in one location. Like the register_globals and variable scope comments. Regards, Philip
Re: [PHP-DOC] [PATCH] Refactoring context options
On 14 Apr 2008, at 11:01, Hannes Magnusson wrote: On Mon, Apr 14, 2008 at 7:24 PM, Philip Olson <[EMAIL PROTECTED]> wrote: On 13 Apr 2008, at 15:05, Hannes Magnusson wrote: Hi all Attached is a patch refactoring context options into its own reference page under the language reference. Pretty much only refactoring and new markup, almost no new content. Hello Hannes- I'm wondering if these should go within the extension docs themselves (ex. reference/curl/context.xml) or all together in one place. Why did you choose to put them all in one place? Before the change they were scattered all around various chapters in the appendix and extremely hard to navigate. Because of that I doubt many people have used any of these features, except for maybe the absolute basic http context options. Furthermore we've had a bug report about the ssl options for good period of time with seemingly noone even knowing where to document them - so how would the user know where they are? :) Since not many extensions define context options I think its better to group them all together for a quick lookup and a better overview over their usefulness. Okay sounds reasonable, will you be adding links to them from the appropriate extensions? I wonder if each context parameters documentation should link to them too... hmm. Also, nice work documenting this scary topic :) Regards, Philip
[PHP-DOC] cvs: pecl /phar func_interceptors.c phar_internal.h /phar/tests readfile.phpt
cellog Tue Apr 15 03:36:56 2008 UTC Added files: /pecl/phar/testsreadfile.phpt Modified files: /pecl/phar func_interceptors.c phar_internal.h Log: add interception for readfile [DOC] http://cvs.php.net/viewvc.cgi/pecl/phar/func_interceptors.c?r1=1.14&r2=1.15&diff_format=u Index: pecl/phar/func_interceptors.c diff -u pecl/phar/func_interceptors.c:1.14 pecl/phar/func_interceptors.c:1.15 --- pecl/phar/func_interceptors.c:1.14 Mon Apr 14 17:31:00 2008 +++ pecl/phar/func_interceptors.c Tue Apr 15 03:36:56 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: func_interceptors.c,v 1.14 2008/04/14 17:31:00 cellog Exp $ */ +/* $Id: func_interceptors.c,v 1.15 2008/04/15 03:36:56 cellog Exp $ */ #include "phar_internal.h" @@ -199,6 +199,83 @@ } /* }}} */ +PHAR_FUNC(phar_readfile) /* {{{ */ +{ + char *filename; + int filename_len; + int size = 0; + zend_bool use_include_path = 0; + zval *zcontext = NULL; + php_stream *stream; + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { + goto skip_phar; + } + if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) { + char *arch, *entry, *fname; + int arch_len, entry_len, fname_len; + php_stream_context *context = NULL; + char *name; + phar_archive_data **pphar; + fname = zend_get_executed_filename(TSRMLS_C); + + if (strncasecmp(fname, "phar://", 7)) { + goto skip_phar; + } + fname_len = strlen(fname); + if (FAILURE == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len TSRMLS_CC)) { + goto skip_phar; + } + + efree(entry); + entry = filename; + /* fopen within phar, if :// is not in the url, then prepend phar:/// */ + entry_len = filename_len; + /* retrieving a file defaults to within the current directory, so use this if possible */ + if (FAILURE == (zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar))) { + efree(arch); + goto skip_phar; + } + if (use_include_path) { + if (!(entry = phar_find_in_include_path(entry, entry_len, NULL TSRMLS_CC))) { + /* this file is not in the phar, use the original path */ + efree(arch); + goto skip_phar; + } else { + name = entry; + } + } else { + entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC); + if (!zend_hash_exists(&((*pphar)->manifest), entry + 1, entry_len - 1)) { + /* this file is not in the phar, use the original path */ + efree(entry); + efree(arch); + goto skip_phar; + } + /* auto-convert to phar:// */ + spprintf(&name, 4096, "phar://%s%s", arch, entry); + efree(entry); + } + + efree(arch); + context = php_stream_context_from_zval(zcontext, 0); + stream = php_stream_open_wrapper_ex(name, "rb", 0 | REPORT_ERRORS, NULL, context); + efree(name); + if (stream == NULL) { + RETURN_FALSE; + } + size = php_stream_passthru(stream); + php_stream_close(stream); + RETURN_LONG(size); + } + +skip_phar: + PHAR_G(orig_readfile)(INTERNAL_FUNCTION_PARAM_PASSTHRU); + return; + +} +/* }}} */ + PHAR_FUNC(phar_fopen) /* {{{ */ { char *filename, *mode; @@ -878,6 +955,7 @@ PHAR_INTERCEPT(is_executable); PHAR_INTERCEPT(lstat); PHAR_INTERCEPT(stat); + PHAR_INTERCEPT(readfile); } /* }}} */ @@ -912,6 +990,7 @@ PHAR_RELEASE(is_executable); PHAR_RELEASE(lstat); PHAR_RELEASE(stat); + PHAR_RELEASE(readfile); } /* }}} */ http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.100&r2=1.101&diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.100 pecl/phar/phar_internal.h:1.101 --- pecl/phar/phar_internal.h:1.100 Mon Apr 14 04:47:33 2008 +++ pecl/phar/phar_internal.h Tue Apr 15 03:36:56 2008 @@ -17,7 +17,7 @@ +
[PHP-DOC] Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/general_functions ini_get_all.phpt
On Mon, Apr 14, 2008 at 7:43 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote: > Hannes Magnusson kirjoitti: > > > > > On Mon, Apr 14, 2008 at 5:40 PM, Jani Taskinen <[EMAIL PROTECTED]> > wrote: > > > > > Eh..do you really understand the code correctly..? ini_get_all() is very > > > much different what config_dump_hash() was/is. > > > > > > > Uhh.. I don't see the difference. And there are no tests to compare it > against. > > I already asked on internals@ and after no reply I tracked down helly > > on IRC and he was fine with merging them. > > > > This function was originally just meant for debugging the config hash. > And hint for the difference is: registered vs. anything (that was > freebie..) > > Rule 1: Learn how to use CVS before you commit (hint: cvs annotate > filename.ext) > Rule 2: Once you learned how to use CVS and figured out who to ask: ASK. > Rule 3: Ask the right people before committing. > Rule 4: IRC != internals@ (I haven't seen ANY question about this on > internals!) > > Now be good boy and revert the crap, that function is VERY useful for > debugging how the php.ini stuff works (or not) and should be there. It was > originally only enabled for debug builds and should always still be, I've no > idea why Marcus made it enabled always in the first place.. Rule#1: Test the stuff you write, not only in your mind, with .phpt too Rule#2: Make sure there are not more than 3 functions doing almost the exact same thing. Rule#3: Subscribe to internals@ and participate in the discussion of your work Rule#4: Add comments about any hidden meanings behind the function Rule#5: Add a frckin [DOC] note to the commit explaining how the stuff works so it can be documented Rule#6: If you write a function just to so it can be used when debugging another internal feature add it in #ifdef FEATURE_DEBUG or whatever so other people don't come after you and wonder wtf you were thinking Rule#7: If a documentor asks for clarifications on internals@ then help him Rule#8: Do not reclassify bug-reports as documentation problem without further information If you don't tell anyone about what you are doing you cannot expect anyone else to know what your intentions are. If the function should be documented, removed, changed, only in debug mode, only there or only here. Marcus apparently thought you made a booboo and renamed it and enabled it in normal builds, and I seeing absolutely no point in yet another ini-get function combined it with another function seemingly serving the same purpose, in slightly different format... I did ask on internals@ if we really did need yet-another-ini-get function and since noone replied I followed your basic principle: Commit and let the trolls flame. -Hannes (learned from the best! ;))
Re: [PHP-DOC] [PATCH] Restructuring built-in variables
On Mon, Apr 14, 2008 at 7:32 PM, Philip Olson <[EMAIL PROTECTED]> wrote: > > On 13 Apr 2008, at 08:01, Daniel Convissor wrote: > > > Hi Hannes: > > > > > > > The idea is to first refactor it with minimum changes so translators > > > don't have to retranslate the entire thing again. > > > Then after the commit it is easy to make any further adjustments, but > > > yeah. That should be noted. > > > > > > > Yeah. Was thinking the same thing. > > > > Thanks for the the fixes, and of course the whole reworking. > > > > This is a great change to the docs, except the first page looks odd with > "Superglobals" essentially being listed twice. Moving that part to its own > little section seems like a good choice. You mean splitting the page in two s, one for superglobals and one for "others"? I agree, it feels a bit weird looking at it at first sight, but the TOC contains all predefined-variables, not only superglobals... -Hannes
Re: [PHP-DOC] [PATCH] Refactoring context options
On Mon, Apr 14, 2008 at 7:24 PM, Philip Olson <[EMAIL PROTECTED]> wrote: > > > On 13 Apr 2008, at 15:05, Hannes Magnusson wrote: > > > Hi all > > > > Attached is a patch refactoring context options into its own reference > > page under the language reference. > > Pretty much only refactoring and new markup, almost no new content. > > > > Hello Hannes- > > I'm wondering if these should go within the extension docs themselves (ex. > reference/curl/context.xml) or all together in one place. Why did you choose > to put them all in one place? Before the change they were scattered all around various chapters in the appendix and extremely hard to navigate. Because of that I doubt many people have used any of these features, except for maybe the absolute basic http context options. Furthermore we've had a bug report about the ssl options for good period of time with seemingly noone even knowing where to document them - so how would the user know where they are? :) Since not many extensions define context options I think its better to group them all together for a quick lookup and a better overview over their usefulness. -Hannes
[PHP-DOC] Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/general_functions ini_get_all.phpt
Hannes Magnusson kirjoitti: On Mon, Apr 14, 2008 at 5:40 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote: Eh..do you really understand the code correctly..? ini_get_all() is very much different what config_dump_hash() was/is. Uhh.. I don't see the difference. And there are no tests to compare it against. I already asked on internals@ and after no reply I tracked down helly on IRC and he was fine with merging them. This function was originally just meant for debugging the config hash. And hint for the difference is: registered vs. anything (that was freebie..) Rule 1: Learn how to use CVS before you commit (hint: cvs annotate filename.ext) Rule 2: Once you learned how to use CVS and figured out who to ask: ASK. Rule 3: Ask the right people before committing. Rule 4: IRC != internals@ (I haven't seen ANY question about this on internals!) Now be good boy and revert the crap, that function is VERY useful for debugging how the php.ini stuff works (or not) and should be there. It was originally only enabled for debug builds and should always still be, I've no idea why Marcus made it enabled always in the first place.. --Jani
Re: [PHP-DOC] [PATCH] Restructuring built-in variables
On 13 Apr 2008, at 08:01, Daniel Convissor wrote: Hi Hannes: The idea is to first refactor it with minimum changes so translators don't have to retranslate the entire thing again. Then after the commit it is easy to make any further adjustments, but yeah. That should be noted. Yeah. Was thinking the same thing. Thanks for the the fixes, and of course the whole reworking. This is a great change to the docs, except the first page looks odd with "Superglobals" essentially being listed twice. Moving that part to its own little section seems like a good choice. Regards, Philip
Re: [PHP-DOC] [PATCH] Refactoring context options
On 13 Apr 2008, at 15:05, Hannes Magnusson wrote: Hi all Attached is a patch refactoring context options into its own reference page under the language reference. Pretty much only refactoring and new markup, almost no new content. Hello Hannes- I'm wondering if these should go within the extension docs themselves (ex. reference/curl/context.xml) or all together in one place. Why did you choose to put them all in one place? Regards, Philip
[PHP-DOC] Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/general_functions ini_get_all.phpt
On Mon, Apr 14, 2008 at 5:40 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote: > Eh..do you really understand the code correctly..? ini_get_all() is very > much different what config_dump_hash() was/is. Uhh.. I don't see the difference. And there are no tests to compare it against. I already asked on internals@ and after no reply I tracked down helly on IRC and he was fine with merging them. -Hannes
[PHP-DOC] Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/general_functions ini_get_all.phpt
Eh..do you really understand the code correctly..? ini_get_all() is very much different what config_dump_hash() was/is. --Jani Hannes Magnusson kirjoitti: bjori Mon Apr 14 15:32:43 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard/tests/general_functions ini_get_all.phpt /php-src/ext/standard basic_functions.c basic_functions.h Log: [DOC] Remove config_get_hash() & and add new boolean parameter to ini_get_all() to list ini entries key=>current_value like config_get_hash() did. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/ini_get_all.phpt?r1=1.1.2.2.2.1&r2=1.1.2.2.2.2&diff_format=u Index: php-src/ext/standard/tests/general_functions/ini_get_all.phpt diff -u php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.1 php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.2 --- php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.1 Mon Oct 1 12:40:54 2007 +++ php-src/ext/standard/tests/general_functions/ini_get_all.phpt Mon Apr 14 15:32:42 2008 @@ -1,5 +1,8 @@ --TEST-- ini_get_all() tests +--INI-- +pcre.backtrack_limit=10 +pcre.recursion_limit=10 --SKIPIF-- --FILE-- @@ -10,6 +13,8 @@ var_dump(ini_get_all("nosuchextension")); var_dump(ini_get_all("reflection")); var_dump(ini_get_all("pcre")); +var_dump(ini_get_all("pcre", false)); +var_dump(ini_get_all("reflection", false)); var_dump(ini_get_all("", "")); @@ -45,7 +50,15 @@ int(7) } } +array(2) { + ["pcre.backtrack_limit"]=> + string(6) "10" + ["pcre.recursion_limit"]=> + string(6) "10" +} +array(0) { +} -Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d -NULL +Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on line %d +bool(false) Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.24&r2=1.725.2.31.2.64.2.25&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.24 php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.25 --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.24 Mon Apr 7 10:44:59 2008 +++ php-src/ext/standard/basic_functions.c Mon Apr 14 15:32:42 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.24 2008/04/07 10:44:59 colder Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.25 2008/04/14 15:32:42 bjori Exp $ */ #include "php.h" #include "php_streams.h" @@ -959,10 +959,6 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) -ZEND_END_ARG_INFO() - -static ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1) ZEND_ARG_INFO(0, types) ZEND_ARG_INFO(0, prefix) @@ -3417,7 +3413,6 @@ 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) - PHP_FE(config_get_hash, arginfo_config_get_hash) PHP_FE(is_uploaded_file, arginfo_is_uploaded_file) PHP_FE(move_uploaded_file, arginfo_move_uploaded_file) @@ -5663,6 +5658,7 @@ { zval *ini_array = va_arg(args, zval *); int module_number = va_arg(args, int); + int details = va_arg(args, int); zval *option; if (module_number != 0 && ini_entry->module_number != module_number) { @@ -5672,40 +5668,49 @@ if (hash_key->nKeyLength == 0 || hash_key->arKey[0] != 0 ) { - MAKE_STD_ZVAL(option); - array_init(option); + if (details) { + MAKE_STD_ZVAL(option); + array_init(option); + + if (ini_entry->orig_value) { + add_assoc_stringl(option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1); + } else if (ini_entry->value) { + add_assoc_stringl(option, "global_value", ini_entry->value, ini_entry->value_length, 1); + } else { + add_assoc_null(option, "global_value"); + } - if (ini_entry->orig_value) { -
[PHP-DOC] cvs: php-src(PHP_5_3) /ext/standard basic_functions.c basic_functions.h /ext/standard/tests/general_functions ini_get_all.phpt
bjori Mon Apr 14 15:32:43 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard/tests/general_functions ini_get_all.phpt /php-src/ext/standard basic_functions.c basic_functions.h Log: [DOC] Remove config_get_hash() & and add new boolean parameter to ini_get_all() to list ini entries key=>current_value like config_get_hash() did. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/ini_get_all.phpt?r1=1.1.2.2.2.1&r2=1.1.2.2.2.2&diff_format=u Index: php-src/ext/standard/tests/general_functions/ini_get_all.phpt diff -u php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.1 php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.2 --- php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.1.2.2.2.1 Mon Oct 1 12:40:54 2007 +++ php-src/ext/standard/tests/general_functions/ini_get_all.phpt Mon Apr 14 15:32:42 2008 @@ -1,5 +1,8 @@ --TEST-- ini_get_all() tests +--INI-- +pcre.backtrack_limit=10 +pcre.recursion_limit=10 --SKIPIF-- --FILE-- @@ -10,6 +13,8 @@ var_dump(ini_get_all("nosuchextension")); var_dump(ini_get_all("reflection")); var_dump(ini_get_all("pcre")); +var_dump(ini_get_all("pcre", false)); +var_dump(ini_get_all("reflection", false)); var_dump(ini_get_all("", "")); @@ -45,7 +50,15 @@ int(7) } } +array(2) { + ["pcre.backtrack_limit"]=> + string(6) "10" + ["pcre.recursion_limit"]=> + string(6) "10" +} +array(0) { +} -Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d -NULL +Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on line %d +bool(false) Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.24&r2=1.725.2.31.2.64.2.25&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.24 php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.25 --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.24 Mon Apr 7 10:44:59 2008 +++ php-src/ext/standard/basic_functions.c Mon Apr 14 15:32:42 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.24 2008/04/07 10:44:59 colder Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.25 2008/04/14 15:32:42 bjori Exp $ */ #include "php.h" #include "php_streams.h" @@ -959,10 +959,6 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) -ZEND_END_ARG_INFO() - -static ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1) ZEND_ARG_INFO(0, types) ZEND_ARG_INFO(0, prefix) @@ -3417,7 +3413,6 @@ 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) - PHP_FE(config_get_hash, arginfo_config_get_hash) PHP_FE(is_uploaded_file, arginfo_is_uploaded_file) PHP_FE(move_uploaded_file, arginfo_move_uploaded_file) @@ -5663,6 +5658,7 @@ { zval *ini_array = va_arg(args, zval *); int module_number = va_arg(args, int); + int details = va_arg(args, int); zval *option; if (module_number != 0 && ini_entry->module_number != module_number) { @@ -5672,40 +5668,49 @@ if (hash_key->nKeyLength == 0 || hash_key->arKey[0] != 0 ) { - MAKE_STD_ZVAL(option); - array_init(option); + if (details) { + MAKE_STD_ZVAL(option); + array_init(option); + + if (ini_entry->orig_value) { + add_assoc_stringl(option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1); + } else if (ini_entry->value) { + add_assoc_stringl(option, "global_value", ini_entry->value, ini_entry->value_length, 1); + } else { + add_assoc_null(option, "global_value"); + } - if (ini_entry->orig_value) { - add_assoc_stringl(option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1); - } else