From: Dmitry Stogov Date: Fri, 15 Jun 2007 07:32:17 +0000 (+0000) Subject: (wrong previous patch) X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~451 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=613b37a73e0c30d5ef8bd171fa71d613c4c36acb;p=php (wrong previous patch) --- diff --git a/main/main.c b/main/main.c index 141f0b16f0..c9766625e2 100644 --- a/main/main.c +++ b/main/main.c @@ -1547,6 +1547,37 @@ int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC) } /* }}} */ +#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400) +static _invalid_parameter_handler old_invalid_parameter_handler; + +void dummy_invalid_parameter_handler( + const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t pEwserved) +{ + static int called = 0; + char buf[1024]; + int len; + + if (!called) { + called = 1; + if (function) { + if (file) { + len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%d)", function, file, line); + } else { + len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws'", function); + } + } else { + len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT parameters detected"); + } + zend_error(E_WARNING, "%s", buf); + called = 0; + } +} +#endif + /* {{{ php_module_startup */ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules) @@ -1576,6 +1607,13 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod php_os="WIN32"; } } +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + old_invalid_parameter_handler = + _set_invalid_parameter_handler(dummy_invalid_parameter_handler); + if (old_invalid_parameter_handler != NULL) { + _set_invalid_parameter_handler(old_invalid_parameter_handler); + } +#endif #else php_os=PHP_OS; #endif @@ -1763,37 +1801,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod /* start additional PHP extensions */ php_register_extensions(&additional_modules, num_additional_modules TSRMLS_CC); -#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400) -static _invalid_parameter_handler old_invalid_parameter_handler; - -void dummy_invalid_parameter_handler( - const wchar_t *expression, - const wchar_t *function, - const wchar_t *file, - unsigned int line, - uintptr_t pEwserved) -{ - static int called = 0; - char buf[1024]; - int len; - - if (!called) { - called = 1; - if (function) { - if (file) { - len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%d)", function, file, line); - } else { - len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws'", function); - } - } else { - len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT parameters detected"); - } - zend_error(E_WARNING, "%s", buf); - called = 0; - } -} -#endif - /* load and startup extensions compiled as shared objects (aka DLLs) as requested by php.ini entries theese are loaded after initialization of internal extensions @@ -2003,13 +2010,6 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) fchdir(old_cwd_fd); close(old_cwd_fd); } -#if defined(_MSC_VER) && (_MSC_VER >= 1400) - old_invalid_parameter_handler = - _set_invalid_parameter_handler(dummy_invalid_parameter_handler); - if (old_invalid_parameter_handler != NULL) { - _set_invalid_parameter_handler(old_invalid_parameter_handler); - } -#endif #else if (old_cwd[0] != '\0') { VCWD_CHDIR(old_cwd);