[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_directory.c spl_directory.h
iliaa Wed Jul 8 03:07:00 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_directory.c spl_directory.h /php-srcNEWS Log: Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked directories). [DOC] To avoid breaking how existing code works a new constant is introduced for the RecursiveDirectoryIterator() that directs the code to follow symlinks. This constant RecursiveDirectoryIterator::FOLLOW_SYMLINKS can be passed a flag to the constructor to trigger symlink following. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.45r2=1.45.2.27.2.23.2.46diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.45 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.46 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.45 Sat Jul 4 20:31:27 2009 +++ php-src/ext/spl/spl_directory.c Wed Jul 8 03:06:58 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.45 2009/07/04 20:31:27 felipe Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.46 2009/07/08 03:06:58 iliaa Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1246,7 +1246,7 @@ return; } spl_filesystem_object_get_file_name(intern TSRMLS_CC); - if (!allow_links) { + if (!allow_links !(intern-flags SPL_FILE_DIR_FOLLOW_SYMLINKS)) { php_stat(intern-file_name, intern-file_name_len, FS_IS_LINK, return_value TSRMLS_CC); if (zend_is_true(return_value)) { RETURN_FALSE; @@ -2656,6 +2656,7 @@ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, CURRENT_AS_SELF, SPL_FILE_DIR_CURRENT_AS_SELF); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, KEY_MODE_MASK, SPL_FILE_DIR_KEY_MODE_MASK); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, KEY_AS_PATHNAME, SPL_FILE_DIR_KEY_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, FOLLOW_SYMLINKS, SPL_FILE_DIR_FOLLOW_SYMLINKS); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, KEY_AS_FILENAME, SPL_FILE_DIR_KEY_AS_FILENAME); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, NEW_CURRENT_AND_KEY, SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, SKIP_DOTS, SPL_FILE_DIR_SKIPDOTS); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.12.2.5.2.4.2.14r2=1.12.2.5.2.4.2.15diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.14 php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.15 --- php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.14 Thu Jun 4 14:46:26 2009 +++ php-src/ext/spl/spl_directory.h Wed Jul 8 03:06:59 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.14 2009/06/04 14:46:26 colder Exp $ */ +/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.15 2009/07/08 03:06:59 iliaa Exp $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H @@ -129,6 +129,7 @@ #define SPL_FILE_DIR_KEY_AS_PATHNAME 0x /* make RecursiveDirectoryTree::key() return getPathname() */ #define SPL_FILE_DIR_KEY_AS_FILENAME 0x0100 /* make RecursiveDirectoryTree::key() return getFilename() */ +#define SPL_FILE_DIR_FOLLOW_SYMLINKS 0x0200 /* make RecursiveDirectoryTree::hasChildren() follow symlinks */ #define SPL_FILE_DIR_KEY_MODE_MASK 0x0F00 /* mask RecursiveDirectoryTree::key() */ #define SPL_FILE_DIR_KEY(intern,mode) ((intern-flagsSPL_FILE_DIR_KEY_MODE_MASK)==mode) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.670r2=1.2027.2.547.2.965.2.671diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.670 php-src/NEWS:1.2027.2.547.2.965.2.671 --- php-src/NEWS:1.2027.2.547.2.965.2.670 Tue Jul 7 22:17:54 2009 +++ php-src/NEWSWed Jul 8 03:06:59 2009 @@ -4,6 +4,8 @@ - Fixed spl_autoload_unregister/spl_autoad_functions wrt. Closures and Functors. (Christian Seiler) +- Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked + directories). (Ilia) - Fixed bug #48771 (rename() between volumes fails and reports no error on Windows). (Pierre) - Fixed bug #48757 (ReflectionFunction::invoke() parameter issues). (Kalle) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_directory.c
dmitry Wed Jun 24 08:53:18 2009 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS /php-src/ext/splspl_directory.c Log: Fixed bug #48643 (String functions memory issue) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.645r2=1.2027.2.547.2.965.2.646diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.645 php-src/NEWS:1.2027.2.547.2.965.2.646 --- php-src/NEWS:1.2027.2.547.2.965.2.645 Tue Jun 23 06:56:45 2009 +++ php-src/NEWSWed Jun 24 08:53:17 2009 @@ -1,6 +1,7 @@ -PHP NEWS +PHPNEWS ||| ?? ??? 2009, PHP 5.3.0 RC 5 +- Fixed bug #48643 (String functions memory issue). (Dmitry) - Fixed bug #48641 (tmpfile() uses old parameter parsing). (crrodriguez at opensuse dot org) - Fixed bug #48624 (.user.ini never gets parsed). (Pierre) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.43r2=1.45.2.27.2.23.2.44diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.43 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.44 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.43 Thu Jun 4 14:46:26 2009 +++ php-src/ext/spl/spl_directory.c Wed Jun 24 08:53:18 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.43 2009/06/04 14:46:26 colder Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.44 2009/06/24 08:53:18 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1604,13 +1604,34 @@ switch (intern-type) { case SPL_FS_INFO: case SPL_FS_FILE: - ZVAL_STRINGL(writeobj, intern-file_name, intern-file_name_len, 1); + if (readobj == writeobj) { + zval retval; + zval *retval_ptr = retval; + + ZVAL_STRINGL(retval_ptr, intern-file_name, intern-file_name_len, 1); + zval_dtor(readobj); + ZVAL_ZVAL(writeobj, retval_ptr, 0, 0); + } else { + ZVAL_STRINGL(writeobj, intern-file_name, intern-file_name_len, 1); + } return SUCCESS; case SPL_FS_DIR: - ZVAL_STRING(writeobj, intern-u.dir.entry.d_name, 1); + if (readobj == writeobj) { + zval retval; + zval *retval_ptr = retval; + + ZVAL_STRING(retval_ptr, intern-u.dir.entry.d_name, 1); + zval_dtor(readobj); + ZVAL_ZVAL(writeobj, retval_ptr, 0, 0); + } else { + ZVAL_STRING(writeobj, intern-u.dir.entry.d_name, 1); + } return SUCCESS; } } + if (readobj == writeobj) { + zval_dtor(readobj); + } ZVAL_NULL(writeobj); return FAILURE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_directory.c /ext/spl/tests bug47534.phpt
colder Sat May 9 21:06:59 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug47534.phpt Modified files: /php-src/ext/splspl_directory.c /php-srcNEWS Log: MFH: Fix bug #47534 (RecursiveDirectoryIterator::getChildren ignoring CURRENT_AS_PATHNAME) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.41r2=1.45.2.27.2.23.2.42diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.41 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.42 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.41 Tue Mar 10 23:28:17 2009 +++ php-src/ext/spl/spl_directory.c Sat May 9 21:06:58 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.41 2009/03/10 23:28:17 helly Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.42 2009/05/09 21:06:58 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1268,24 +1268,27 @@ spl_filesystem_object_get_file_name(intern TSRMLS_CC); - INIT_PZVAL(zflags); - INIT_PZVAL(zpath); - ZVAL_LONG(zflags, intern-flags); - ZVAL_STRINGL(zpath, intern-file_name, intern-file_name_len, 0); - - spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); - - subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); - if (subdir) { - if (intern-u.dir.sub_path intern-u.dir.sub_path[0]) { - subdir-u.dir.sub_path_len = spprintf(subdir-u.dir.sub_path, 0, %s%c%s, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); - } else { - subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); - subdir-u.dir.sub_path = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); + if (SPL_HAS_FLAG(intern-flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { + RETURN_STRINGL(intern-file_name, intern-file_name_len, 1); + } else { + INIT_PZVAL(zflags); + INIT_PZVAL(zpath); + ZVAL_LONG(zflags, intern-flags); + ZVAL_STRINGL(zpath, intern-file_name, intern-file_name_len, 0); + spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); + + subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); + if (subdir) { + if (intern-u.dir.sub_path intern-u.dir.sub_path[0]) { + subdir-u.dir.sub_path_len = spprintf(subdir-u.dir.sub_path, 0, %s%c%s, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); + } else { + subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); + subdir-u.dir.sub_path = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); + } + subdir-info_class = intern-info_class; + subdir-file_class = intern-file_class; + subdir-oth = intern-oth; } - subdir-info_class = intern-info_class; - subdir-file_class = intern-file_class; - subdir-oth = intern-oth; } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.593r2=1.2027.2.547.2.965.2.594diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.593 php-src/NEWS:1.2027.2.547.2.965.2.594 --- php-src/NEWS:1.2027.2.547.2.965.2.593 Sat May 9 20:42:44 2009 +++ php-src/NEWSSat May 9 21:06:59 2009 @@ -63,6 +63,8 @@ - Fixed bug #47560 (explode()'s limit parameter odd behaviour). (Matt) - Fixed bug #47535 (Compilation failure in ps_fetch_from_1_to_8_bytes()). (Johannes) +- Fixed bug #47534 (RecursiveDiteratoryIterator::getChildren ignoring + CURRENT_AS_PATHNAME). (Etienne) - Fixed bug #47516 (nowdoc can not be embed in heredoc but can be embed in double quote). (Dmitry) - Fixed bug #47038 (Memory leak in include). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug47534.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug47534.phpt +++ php-src/ext/spl/tests/bug47534.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_directory.c spl_directory.h /ext/standard file.c file.h /ext/standard/tests/file bug40501.csv bug40501.phpt fgetcsv_error.phpt
dsp Wed Oct 3 10:44:32 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/filebug40501.csv bug40501.phpt Modified files: /php-srcNEWS /php-src/ext/splspl_directory.c spl_directory.h /php-src/ext/standard file.c file.h /php-src/ext/standard/tests/filefgetcsv_error.phpt Log: MFH: Add an escape parameter to fgetcsv to satisfy rfc4180 and bug #40501. [DOC] 5th parameter available since PHP 5.3+ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.20r2=1.2027.2.547.2.965.2.21diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.20 php-src/NEWS:1.2027.2.547.2.965.2.21 --- php-src/NEWS:1.2027.2.547.2.965.2.20Wed Oct 3 10:33:01 2007 +++ php-src/NEWSWed Oct 3 10:44:32 2007 @@ -1,6 +1,7 @@ PHPNEWS ||| ?? ??? 20??, PHP 5.3.0 +- Added optional escape character parameter to fgetcsv. (David Soria Parra) - Added xsl-setProfiling() for profiling stylesheets. (Christian) - Added long-option feature to getopt() and made getopt() available also on win32 systems by adding a common getopt implementation into core. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.1r2=1.45.2.27.2.23.2.2diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.1 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.2 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.1 Thu Sep 27 18:00:44 2007 +++ php-src/ext/spl/spl_directory.c Wed Oct 3 10:44:32 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.1 2007/09/27 18:00:44 dmitry Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.2 2007/10/03 10:44:32 dsp Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1589,7 +1589,7 @@ spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2 TSRMLS_CC); \ } -static int spl_filesystem_file_read_csv(spl_filesystem_object *intern, char delimiter, char enclosure, zval *return_value TSRMLS_DC) /* {{{ */ +static int spl_filesystem_file_read_csv(spl_filesystem_object *intern, char delimiter, char enclosure, char escape, zval *return_value TSRMLS_DC) /* {{{ */ { int ret = SUCCESS; @@ -1606,7 +1606,7 @@ } ALLOC_INIT_ZVAL(intern-u.file.current_zval); - php_fgetcsv(intern-u.file.stream, delimiter, enclosure, buf_len, buf, intern-u.file.current_zval TSRMLS_CC); + php_fgetcsv(intern-u.file.stream, delimiter, enclosure, escape, buf_len, buf, intern-u.file.current_zval TSRMLS_CC); if (return_value) { if (Z_TYPE_P(return_value) != IS_NULL) { zval_dtor(return_value); @@ -1632,7 +1632,7 @@ return FAILURE; } if (intern-flags SPL_FILE_OBJECT_READ_CSV) { - return spl_filesystem_file_read_csv(intern, intern-u.file.delimiter, intern-u.file.enclosure, NULL TSRMLS_CC); + return spl_filesystem_file_read_csv(intern, intern-u.file.delimiter, intern-u.file.enclosure, intern-u.file.escape, NULL TSRMLS_CC); } else { zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(getThis()), intern-u.file.func_getCurr, getCurrentLine, retval); } @@ -1943,18 +1943,25 @@ } /* }}} */ -/* {{{ proto array SplFileObject::fgetcsv([string delimiter [, string enclosure]]) +/* {{{ proto array SplFileObject::fgetcsv([string delimiter [, string enclosure [, escape = '\\']]]) Return current line as csv */ SPL_METHOD(SplFileObject, fgetcsv) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - char delimiter = intern-u.file.delimiter, enclosure = intern-u.file.enclosure; - char *delim, *enclo; - int d_len, e_len; + char delimiter = intern-u.file.delimiter, enclosure = intern-u.file.enclosure, escape = intern-u.file.escape; + char *delim, *enclo, *esc; + int d_len, e_len, esc_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |ss, delim, d_len, enclo, e_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sss, delim, d_len, enclo, e_len, esc, esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { + case 3: + if (esc_len != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, escape must be a character); + RETURN_FALSE; +