Re: [INTERNALS-WIN] end of support for VC6 in trunk

From: Date: Sun, 04 Oct 2009 16:16:40 +0000
Subject: Re: [INTERNALS-WIN] end of support for VC6 in trunk
References: 1 2 3 4 5 6 7  Groups: php.internals.win 
Request: Send a blank email to internals-win+get-632@lists.php.net to get a copy of this message
hi William, On Tue, Sep 22, 2009 at 11:07 PM, William A. Rowe, Jr. <wrowe@rowe-clan.net> wrote: > William A. Rowe, Jr. wrote: >> Pierre Joye wrote: >>>> Since the whole mod_php SetIni is not threadsafe, >>> What are you refering to here? :) >> >> Just looking at sapi/apache_hooks, it >> seems that ini processing changed significantly between 5.2 and 5.3. > > I'm evaluating this, it may take a couple days to get my head around > the code since I had a couple other urgent items on my plate right now. > If I see any issues, I'll sound off this coming week. I may have found something that could cause issues in TS SAPI, inside the php.ini management code. We were initializing a static point to the GetSystemWindowsDirectory function, without worrying about concurrent access (init time). As this function is available now in our minimal windows versions, I simply use GetSystemWindowsDirectory directly instead of using LoadLibrary and GetProcAddress. Patch attached. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org

Index: main/php_ini.c =================================================================== --- main/php_ini.c (revision 288722) +++ main/php_ini.c (working copy) @@ -488,33 +488,20 @@ } strlcat(php_ini_search_path, default_location, search_path_size); } - efree(default_location); - { - /* For people running under terminal services, GetWindowsDirectory will - * return their personal Windows directory, so lets add the system - * windows directory too */ - typedef UINT (WINAPI *get_system_windows_directory_func)(char *buffer, UINT size); - static get_system_windows_directory_func get_system_windows_directory = NULL; - HMODULE kern; - - if (get_system_windows_directory == NULL) { - kern = LoadLibrary("kernel32.dll"); - if (kern) { - get_system_windows_directory = (get_system_windows_directory_func)GetProcAddress(kern, "GetSystemWindowsDirectoryA"); - } + /* For people running under terminal services, GetWindowsDirectory will + * return their personal Windows directory, so lets add the system + * windows directory too */ + default_location = (char *) emalloc(MAXPATHLEN + 1); + + if (0 < GetSystemWindowsDirectory(default_location, MAXPATHLEN)) { + if (*php_ini_search_path) { + strlcat(php_ini_search_path, paths_separator, search_path_size); } - if (get_system_windows_directory != NULL) { - default_location = (char *) emalloc(MAXPATHLEN + 1); - if (0 < get_system_windows_directory(default_location, MAXPATHLEN)) { - if (*php_ini_search_path) { - strlcat(php_ini_search_path, paths_separator, search_path_size); - } - strlcat(php_ini_search_path, default_location, search_path_size); - } - efree(default_location); - } + strlcat(php_ini_search_path, default_location, search_path_size); } + efree(default_location); + #else default_location = PHP_CONFIG_FILE_PATH; if (*php_ini_search_path) {
« previous php.internals.win (#632) next »