[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/standard/file.c branches/PHP_5_3/ext/standard/file.h branches/PHP_5_3/ext/standard/ftp_fopen_wrapper.c branches/PHP_5_3/ext/stan
cataphract Fri, 29 Oct 2010 15:29:15 + Revision: http://svn.php.net/viewvc?view=revision&revision=304985 Log: - Fixed bug #53198 (changing INI setting "from" with ini_set did not have any effect) #Made "from" a proper INI setting and bound it to a global variable. #Previously, it was simply read from the hash table with the parsed ini file #by using cfg_get_string (I wonder why this mechanism still exists...) Bug: http://bugs.php.net/53198 (Assigned) "From:" header sent on http request when using stream_context. Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/standard/file.c U php/php-src/branches/PHP_5_3/ext/standard/file.h U php/php-src/branches/PHP_5_3/ext/standard/ftp_fopen_wrapper.c U php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c A php/php-src/branches/PHP_5_3/ext/standard/tests/http/bug53198.phpt U php/php-src/trunk/ext/standard/file.c U php/php-src/trunk/ext/standard/file.h U php/php-src/trunk/ext/standard/ftp_fopen_wrapper.c U php/php-src/trunk/ext/standard/http_fopen_wrapper.c A php/php-src/trunk/ext/standard/tests/http/bug53198.phpt Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2010-10-29 15:02:39 UTC (rev 304984) +++ php/php-src/branches/PHP_5_3/NEWS 2010-10-29 15:29:15 UTC (rev 304985) @@ -44,6 +44,8 @@ - Fixed ReflectionProperty::isDefault() giving a wrong result for properties obtained with ReflectionClass::getProperties(). (Gustavo) +- Fixed bug #53198 (changing INI setting "from" with ini_set did not have any + effect). (Gustavo) - Fixed bug #53180 (post_max_size=0 not disabling the limit when the content type is application/x-www-form-urlencoded or is not registered with PHP). (gm at tlink dot de, Gustavo) Modified: php/php-src/branches/PHP_5_3/ext/standard/file.c === --- php/php-src/branches/PHP_5_3/ext/standard/file.c 2010-10-29 15:02:39 UTC (rev 304984) +++ php/php-src/branches/PHP_5_3/ext/standard/file.c 2010-10-29 15:29:15 UTC (rev 304985) @@ -170,6 +170,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals) + STD_PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, OnUpdateString, from_address, php_file_globals, file_globals) STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals) STD_PHP_INI_ENTRY("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateLong, auto_detect_line_endings, php_file_globals, file_globals) PHP_INI_END() Modified: php/php-src/branches/PHP_5_3/ext/standard/file.h === --- php/php-src/branches/PHP_5_3/ext/standard/file.h 2010-10-29 15:02:39 UTC (rev 304984) +++ php/php-src/branches/PHP_5_3/ext/standard/file.h 2010-10-29 15:29:15 UTC (rev 304985) @@ -118,7 +118,8 @@ size_t def_chunk_size; long auto_detect_line_endings; long default_socket_timeout; - char *user_agent; + char *user_agent; /* for the http wrapper */ + char *from_address; /* for the ftp and http wrappers */ char *user_stream_current_filename; /* for simple recursion protection */ php_stream_context *default_context; HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */ Modified: php/php-src/branches/PHP_5_3/ext/standard/ftp_fopen_wrapper.c === --- php/php-src/branches/PHP_5_3/ext/standard/ftp_fopen_wrapper.c 2010-10-29 15:02:39 UTC (rev 304984) +++ php/php-src/branches/PHP_5_3/ext/standard/ftp_fopen_wrapper.c 2010-10-29 15:29:15 UTC (rev 304985) @@ -116,7 +116,6 @@ php_stream *stream = NULL, *reuseid = NULL; php_url *resource = NULL; int result, use_ssl, use_ssl_on_data = 0, tmp_len; - char *scratch; char tmp_line[512]; char *transport; int transport_len; @@ -250,8 +249,8 @@ } else { /* if the user has configured who they are, send that as the password */ - if (cfg_get_string("from", &scratch) == SUCCESS) { -php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", scratch); + if (FG(from_address)) { +php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", FG(from_address)); } else { php_stream_write_string(stream, "PASS anonymous\r\n"); } Modified: php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c === --- php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c 2010-10-29 15:02:39 UTC (rev 304984) +++ php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c 2010-10-29 15:29:15 UTC (rev 304985) @@ -443,8 +443,8 @@ } /* if the user has configured who they are, send a From: line */ - if (((have_header & HTTP_HEADE
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h trunk/ext/mysqlnd/mysqlnd_debug.c tru
andrey Fri, 29 Oct 2010 15:02:39 + Revision: http://svn.php.net/viewvc?view=revision&revision=304984 Log: - More features for the profiling, create aggregates and dump them on file close. - Also add a trace modifier to switch on and off the profiling. - With additional compiler switch the profiling can be completely omitted, of course it makes sense only when --enable-debug. Because otherwise there is no tracing, thus no profiling. - Added a fix for Windows for handling trace files on different devices (special handing of ':' ) Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h U php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h U php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c 2010-10-29 14:36:28 UTC (rev 304983) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c 2010-10-29 15:02:39 UTC (rev 304984) @@ -36,16 +36,6 @@ #define MYSQLND_ZTS(self) #endif -#define MYSQLND_DEBUG_DUMP_TIME1 -#define MYSQLND_DEBUG_DUMP_TRACE 2 -#define MYSQLND_DEBUG_DUMP_PID4 -#define MYSQLND_DEBUG_DUMP_LINE8 -#define MYSQLND_DEBUG_DUMP_FILE16 -#define MYSQLND_DEBUG_DUMP_LEVEL 32 -#define MYSQLND_DEBUG_APPEND64 -#define MYSQLND_DEBUG_FLUSH 128 -#define MYSQLND_DEBUG_TRACE_MEMORY_CALLS 256 - static const char mysqlnd_emalloc_name[] = "_mysqlnd_emalloc"; static const char mysqlnd_pemalloc_name[] = "_mysqlnd_pemalloc"; static const char mysqlnd_ecalloc_name[] = "_mysqlnd_ecalloc"; @@ -81,6 +71,7 @@ NULL /* must be always last */ }; + /* {{{ mysqlnd_debug::open */ static enum_func_status MYSQLND_METHOD(mysqlnd_debug, open)(MYSQLND_DEBUG * self, zend_bool reopen) @@ -300,13 +291,12 @@ /* FALSE - The DBG_ calls won't be traced, TRUE - will be traced */ -/* {{{ mysqlnd_res_meta::func_enter */ +/* {{{ mysqlnd_debug::func_enter */ static zend_bool MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self, unsigned int line, const char * const file, const char * const func_name, unsigned int func_name_len) { - uint64_t some_time = 0; if ((self->flags & MYSQLND_DEBUG_DUMP_TRACE) == 0 || self->file_name == NULL) { return FALSE; } @@ -319,7 +309,12 @@ while (*p) { if (*p == func_name) { zend_stack_push(&self->call_stack, "", sizeof("")); -zend_stack_push(&self->call_time_stack, &some_time, sizeof(some_time)); +#ifndef MYSQLND_PROFILING_DISABLED +if (self->flags & MYSQLND_DEBUG_PROFILE_CALLS) { + uint64_t some_time = 0; + zend_stack_push(&self->call_time_stack, &some_time, sizeof(some_time)); +} +#endif return FALSE; } p++; @@ -327,7 +322,12 @@ } zend_stack_push(&self->call_stack, func_name, func_name_len + 1); - zend_stack_push(&self->call_time_stack, &some_time, sizeof(some_time)); +#ifndef MYSQLND_PROFILING_DISABLED + if (self->flags & MYSQLND_DEBUG_PROFILE_CALLS) { + uint64_t some_time = 0; + zend_stack_push(&self->call_time_stack, &some_time, sizeof(some_time)); + } +#endif if (zend_hash_num_elements(&self->not_filtered_functions) && 0 == zend_hash_exists(&self->not_filtered_functions, func_name, strlen(func_name) + 1)) @@ -340,14 +340,33 @@ } /* }}} */ +#ifndef MYSQLND_PROFILING_DISABLED +struct st_mysqlnd_dbg_function_profile { + uint64_t calls; + uint64_t min_own; + uint64_t max_own; + uint64_t avg_own; + uint64_t own_underporm_calls; + uint64_t min_in_calls; + uint64_t max_in_calls; + uint64_t avg_in_calls; + uint64_t in_calls_underporm_calls; + uint64_t min_total; + uint64_t max_total; + uint64_t avg_total; + uint64_t total_underporm_calls; +}; +#define PROFILE_UNDERPERFORM_THRESHOLD 10 +#endif -/* {{{ mysqlnd_res_meta::func_leave */ +/* {{{ mysqlnd_debug::func_leave */ static enum_func_status MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * const file, uint64_t call_time) { char *func_name; uint64_t * parent_non_own_time_ptr = NULL, * mine_non_own_time_ptr = NULL; - uint64_t mine_non_own_time; + uint64_t mine_non_own_time = 0; + zend_bool profile_calls = self->flags & MYSQLND_DEBUG_PROFILE_CALLS? TRUE:FALSE; if ((self->flags & MYSQLND_DEBUG_DUMP_TRACE) == 0 || self->file_name == NULL) { return PASS; @@ -358,47 +377,150 @@ zend_stack_top(&self->call_stack, (void **)&func_name); +#ifndef MYSQLND_PROFILING_DISABLED + if (profile_calls) { + zend_stack_top(&self->call_time_stack, (void **)&mine_non_own_time_ptr); + mine_non_own_time = *mine_non_own_time_ptr; + zend_stack_del_top(&self->call_time_stack); /* callee - removing ourselves */ + } +#endif - zend_stack_top(&sel