cvs: php4 / NEWS /ext/standard dir.c

From: Date: Tue, 27 Jun 2000 18:44:30 +0000
Subject: cvs: php4 / NEWS /ext/standard dir.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-513@lists.php.net to get a copy of this message
zeev Tue Jun 27 11:44:30 2000 EDT Modified files: /php4 NEWS /php4/ext/standard dir.c Log: Fixed a bug in opendir(), which prevented readdir() from working properly if the $dir argument wasn't explicitly specified Index: php4/NEWS diff -u php4/NEWS:1.327 php4/NEWS:1.328 --- php4/NEWS:1.327 Mon Jun 26 21:45:53 2000 +++ php4/NEWS Tue Jun 27 11:44:30 2000 @@ -2,7 +2,9 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 28 Jun 2000, Version 4.0.1 -- Make --enable-discard-path work again. (Andi) +- Fixed a bug in opendir(), which prevented readdir() from working properly if + the $dir argument wasn't explicitly specified (Zeev) +- Made --enable-discard-path work again. (Andi) - Removed 8KB limit on line length of the file() function (Zeev) - Disabled dl() when PHP is being used as a module inside a multithreaded web server - it didn't work before, and caused weird results (Zeev) @@ -96,8 +98,8 @@ - Clean up constants in flock() function and add optional 3rd arg which is set to true on EWOULDBLOCK (Rasmus) - Added functions pg_loimport(), pg_loexport(). (Jouni) -- Add SWF support to getimagesize() function (Derick Rethans) -- Add support for both indexed and non-indexed arrays of file uploads +- Added SWF support to getimagesize() function (Derick Rethans) +- Added support for both indexed and non-indexed arrays of file uploads eg. name="file[]" type="file" (Rasmus) - Added create_function(), which gives the ability to create functions on-the-fly (Zeev, Zend Engine) @@ -151,7 +153,7 @@ jpeg images it generates. (Rasmus) - Fixed basename() bug where "file.ext///" would not return the same as "/path/file.ext///" (Rasmus) -- Add the swf_ortho function. (Sterling) +- Added the swf_ortho function. (Sterling) - Moved to virtual current working directory support. This highly improves the functionality and stability of multi-threaded versions of PHP (Andi, Sascha) Index: php4/ext/standard/dir.c diff -u php4/ext/standard/dir.c:1.39 php4/ext/standard/dir.c:1.40 --- php4/ext/standard/dir.c:1.39 Fri Jun 9 01:40:27 2000 +++ php4/ext/standard/dir.c Tue Jun 27 11:44:30 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.39 2000/06/09 08:40:27 andi Exp $ */ +/* $Id: dir.c,v 1.40 2000/06/27 18:44:30 zeev Exp $ */ /* {{{ includes/startup/misc */ @@ -45,12 +45,20 @@ } php_dir_globals; #ifdef ZTS -#define DIR(v) (dir_globals->v) +#define DIRG(v) (dir_globals->v) #define DIRLS_FETCH() php_dir_globals *dir_globals = ts_resource(dir_globals_id) +#define DIRLS_D php_dir_globals *dir_globals +#define DIRLS_DC , DIRLS_D +#define DIRLS_C dir_globals +#define DIRLS_CC , DIRLS_C int dir_globals_id; #else -#define DIR(v) (dir_globals.v) +#define DIRG(v) (dir_globals.v) #define DIRLS_FETCH() +#define DIRLS_D +#define DIRLS_DC +#define DIRLS_C +#define DIRLS_CC php_dir_globals dir_globals; #endif @@ -73,7 +81,7 @@ } \ ZEND_FETCH_RESOURCE(dirp,php_dir *,tmp,-1, "Directory", le_dirp); \ } else { \ - ZEND_FETCH_RESOURCE(dirp,php_dir *,0,DIR(default_dir), "Directory", le_dirp); \ + ZEND_FETCH_RESOURCE(dirp,php_dir *,0,DIRG(default_dir), "Directory", le_dirp); \ } \ } else if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &id) == FAILURE) { \ WRONG_PARAM_COUNT; \ @@ -89,18 +97,26 @@ }; +static void php_set_default_dir(int id DIRLS_DC) +{ + if (DIRG(default_dir)!=-1) { + zend_list_delete(DIRG(default_dir)); + } + DIRG(default_dir) = id; + zend_list_addref(id); +} + + static void _dir_dtor(php_dir *dirp) { closedir(dirp->dir); efree(dirp); } -#ifdef ZTS -static void php_dir_init_globals(php_dir_globals *dir_globals) +static void php_dir_init_globals(DIRLS_D) { - DIR(default_dir) = 0; + DIRG(default_dir) = -1; } -#endif PHP_MINIT_FUNCTION(dir) { @@ -114,7 +130,7 @@ #ifdef ZTS dir_globals_id = ts_allocate_id(sizeof(php_dir_globals), (ts_allocate_ctor) php_dir_init_globals, NULL); #else - DIR(default_dir) = 0; + php_dir_init_globals(DIRLS_C); #endif return SUCCESS; @@ -150,7 +166,7 @@ dirp->id = zend_list_insert(dirp,le_dirp); - DIR(default_dir) = dirp->id; + php_set_default_dir(dirp->id DIRLS_CC); if (createobject) { object_init_ex(return_value, dir_class_entry_ptr);

« previous php.cvs (#513) next »