[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
felipe Mon Jun 22 11:37:31 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: - Fixed bug #48641 (tmpfile() uses old parameter parsing) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.35r2=1.409.2.6.2.28.2.36diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.35 php-src/ext/standard/file.c:1.409.2.6.2.28.2.36 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.35 Sun May 24 16:01:47 2009 +++ php-src/ext/standard/file.c Mon Jun 22 11:37:30 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.35 2009/05/24 16:01:47 iliaa Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.36 2009/06/22 11:37:30 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -869,8 +869,8 @@ { php_stream *stream; - if (ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters_none() == FAILURE) { + return; } stream = php_stream_fopen_tmpfile(); -- 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) /ext/standard file.c /ext/standard/tests/file fgetcsv_variation14.phpt fgetcsv_variation21.phpt
iliaa Sun May 24 16:01:48 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/filefgetcsv_variation14.phpt fgetcsv_variation21.phpt Log: MFB: Improve fix for bug #48313 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.34r2=1.409.2.6.2.28.2.35diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.34 php-src/ext/standard/file.c:1.409.2.6.2.28.2.35 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.34 Thu May 21 02:15:03 2009 +++ php-src/ext/standard/file.c Sun May 24 16:01:47 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.34 2009/05/21 02:15:03 jani Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.35 2009/05/24 16:01:47 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2108,6 +2108,7 @@ char *temp, *tptr, *bptr, *line_end, *limit; size_t temp_len, line_end_len; int inc_len; + zend_bool first_field = 1; /* initialize internal state */ php_mblen(NULL, 0); @@ -2159,6 +2160,11 @@ } quit_loop_1: + if (first_field bptr == line_end) { + add_next_index_null(return_value); + break; + } + first_field = 0; /* 2. Read field, leaving bptr pointing at start of next field */ if (inc_len != 0 *bptr == enclosure) { int state = 0; @@ -2355,12 +2361,8 @@ } /* 3. Now pass our field back to php */ - if (comp_end - temp) { - *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); - } else { - add_next_index_null(return_value); - } + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); } while (inc_len 0); out: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fgetcsv_variation14.phpt?r1=1.1.2.2r2=1.1.2.2.2.1diff_format=u Index: php-src/ext/standard/tests/file/fgetcsv_variation14.phpt diff -u php-src/ext/standard/tests/file/fgetcsv_variation14.phpt:1.1.2.2 php-src/ext/standard/tests/file/fgetcsv_variation14.phpt:1.1.2.2.2.1 --- php-src/ext/standard/tests/file/fgetcsv_variation14.phpt:1.1.2.2Tue Aug 14 14:07:46 2007 +++ php-src/ext/standard/tests/file/fgetcsv_variation14.phptSun May 24 16:01:48 2009 @@ -75,7 +75,7 @@ -- Testing fgetcsv() with file opened using r mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -86,7 +86,7 @@ -- Testing fgetcsv() with file opened using rb mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -97,7 +97,7 @@ -- Testing fgetcsv() with file opened using rt mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -108,7 +108,7 @@ -- Testing fgetcsv() with file opened using r+ mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -119,7 +119,7 @@ -- Testing fgetcsv() with file opened using r+b mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -130,7 +130,7 @@ -- Testing fgetcsv() with file opened using r+t mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -141,7 +141,7 @@ -- Testing fgetcsv() with file opened using a+ mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -152,7 +152,7 @@ -- Testing fgetcsv() with file opened using a+b mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -163,7 +163,7 @@ -- Testing fgetcsv() with file opened using a+t mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -174,7 +174,7 @@ -- Testing fgetcsv() with file opened using w+ mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -185,7 +185,7 @@ -- Testing fgetcsv() with file opened using w+b mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -196,7 +196,7 @@ -- Testing fgetcsv() with file opened using w+t mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -207,7 +207,7 @@ -- Testing fgetcsv() with file opened using x+ mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -218,7 +218,7 @@ -- Testing fgetcsv() with file opened using x+b mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) @@ -229,7 +229,7 @@ -- Testing fgetcsv() with file opened using x+t mode -- array(1) { [0]= - string(0) + NULL } int(1) bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fgetcsv_variation21.phpt?r1=1.1.2.1r2=1.1.2.1.2.1diff_format=u Index:
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
janiThu May 21 02:15:03 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: MFH: ws http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.33r2=1.409.2.6.2.28.2.34diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.33 php-src/ext/standard/file.c:1.409.2.6.2.28.2.34 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.33 Mon May 18 18:45:30 2009 +++ php-src/ext/standard/file.c Thu May 21 02:15:03 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.33 2009/05/18 18:45:30 iliaa Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.34 2009/05/21 02:15:03 jani Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -43,61 +43,66 @@ #include sys/types.h #include sys/stat.h #include fcntl.h + #ifdef PHP_WIN32 -#include io.h -#define O_RDONLY _O_RDONLY -#include win32/param.h -#include win32/winutil.h -#include win32/fnmatch.h +# include io.h +# define O_RDONLY _O_RDONLY +# include win32/param.h +# include win32/winutil.h +# include win32/fnmatch.h #elif defined(NETWARE) -#include sys/param.h -#include sys/select.h -#ifdef USE_WINSOCK -#include novsock2.h -#else -#include sys/socket.h -#include netinet/in.h -#include netdb.h -#endif +# include sys/param.h +# include sys/select.h +# ifdef USE_WINSOCK +# include novsock2.h +# else +# include sys/socket.h +# include netinet/in.h +# include netdb.h +# endif #else -#if HAVE_SYS_PARAM_H -#include sys/param.h -#endif -#if HAVE_SYS_SELECT_H -#include sys/select.h -#endif -#if defined(NETWARE) defined(USE_WINSOCK) -#include novsock2.h -#else -#include sys/socket.h -#include netinet/in.h -#include netdb.h -#endif -#if HAVE_ARPA_INET_H -#include arpa/inet.h -#endif +# if HAVE_SYS_PARAM_H +# include sys/param.h +# endif +# if HAVE_SYS_SELECT_H +# include sys/select.h +# endif +# if defined(NETWARE) defined(USE_WINSOCK) +# include novsock2.h +# else +# include sys/socket.h +# include netinet/in.h +# include netdb.h +# endif +# if HAVE_ARPA_INET_H +# include arpa/inet.h +# endif #endif + #include ext/standard/head.h #include safe_mode.h #include php_string.h #include file.h + #if HAVE_PWD_H -#ifdef PHP_WIN32 -#include win32/pwd.h -#else -#include pwd.h -#endif +# ifdef PHP_WIN32 +# include win32/pwd.h +# else +# include pwd.h +# endif #endif + #ifdef HAVE_SYS_TIME_H -#include sys/time.h +# include sys/time.h #endif + #include fsock.h #include fopen_wrappers.h #include streamsfuncs.h #include php_globals.h #ifdef HAVE_SYS_FILE_H -#include sys/file.h +# include sys/file.h #endif #if MISSING_FCLOSE_DECL @@ -105,7 +110,7 @@ #endif #ifdef HAVE_SYS_MMAN_H -#include sys/mman.h +# include sys/mman.h #endif #include scanf.h @@ -118,18 +123,18 @@ #endif #if defined(HAVE_FNMATCH) !defined(PHP_WIN32) -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include fnmatch.h +# ifndef _GNU_SOURCE +# define _GNU_SOURCE +# endif +# include fnmatch.h #endif #ifdef HAVE_WCHAR_H -#include wchar.h +# include wchar.h #endif #ifndef S_ISDIR -#define S_ISDIR(mode) (((mode)S_IFMT) == S_IFDIR) +# define S_ISDIR(mode) (((mode)S_IFMT) == S_IFDIR) #endif /* }}} */ @@ -199,7 +204,7 @@ REGISTER_LONG_CONSTANT(LOCK_UN, PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(LOCK_NB, PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(STREAM_NOTIFY_CONNECT, PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(STREAM_NOTIFY_CONNECT, PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_AUTH_REQUIRED, PHP_STREAM_NOTIFY_AUTH_REQUIRED,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_AUTH_RESULT, PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_MIME_TYPE_IS, PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); @@ -210,9 +215,9 @@ REGISTER_LONG_CONSTANT(STREAM_NOTIFY_COMPLETED, PHP_STREAM_NOTIFY_COMPLETED,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_RESOLVE, PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_INFO, PHP_STREAM_NOTIFY_SEVERITY_INFO,CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_WARN, PHP_STREAM_NOTIFY_SEVERITY_WARN,CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_ERR, PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_INFO,
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
Yes, the code indeed is very different. I suggest you look in the mirror to find out who to blame. And then do a diff -u between file.c on PHP_5_2, PHP_5_3 and HEAD. Make your life easier and sync the files between branches before you commit any more fixes.. --Jani p.s. I found 1 other bug not being fixed in HEAD by very quick diff and cvs log rumba. Guess who committed that one? Ilia Alshanetsky kirjoitti: Work in progress, the code is very different there and the patch will be very different. Ilia Alshanetsky On 18-May-09, at 5:19 PM, Jani Taskinen wrote: What about HEAD? --Jani Ilia Alshanetsky kirjoitti: iliaaMon May 18 18:45:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standardfile.c Log: Fixed bug #48313 (fgetcsv() does not return null for empty rows) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.32r2=1.409.2.6.2.28.2.33diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 php-src/ext/standard/file.c:1.409.2.6.2.28.2.33 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.32Fri May 8 09:44:17 2009 +++ php-src/ext/standard/file.cMon May 18 18:45:30 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.32 2009/05/08 09:44:17 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.33 2009/05/18 18:45:30 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2343,8 +2343,12 @@ } /* 3. Now pass our field back to php */ -*comp_end = '\0'; -add_next_index_stringl(return_value, temp, comp_end - temp, 1); +if (comp_end - temp) { +*comp_end = '\0'; +add_next_index_stringl(return_value, temp, comp_end - temp, 1); +} else { +add_next_index_null(return_value); +} } while (inc_len 0); out: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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) /ext/standard file.c
iliaa Mon May 18 18:45:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fixed bug #48313 (fgetcsv() does not return null for empty rows) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.32r2=1.409.2.6.2.28.2.33diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 php-src/ext/standard/file.c:1.409.2.6.2.28.2.33 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 Fri May 8 09:44:17 2009 +++ php-src/ext/standard/file.c Mon May 18 18:45:30 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.32 2009/05/08 09:44:17 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.33 2009/05/18 18:45:30 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2343,8 +2343,12 @@ } /* 3. Now pass our field back to php */ - *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); + if (comp_end - temp) { + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); + } else { + add_next_index_null(return_value); + } } while (inc_len 0); out: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
What about HEAD? --Jani Ilia Alshanetsky kirjoitti: iliaa Mon May 18 18:45:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fixed bug #48313 (fgetcsv() does not return null for empty rows) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.32r2=1.409.2.6.2.28.2.33diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 php-src/ext/standard/file.c:1.409.2.6.2.28.2.33 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 Fri May 8 09:44:17 2009 +++ php-src/ext/standard/file.c Mon May 18 18:45:30 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.32 2009/05/08 09:44:17 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.33 2009/05/18 18:45:30 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2343,8 +2343,12 @@ } /* 3. Now pass our field back to php */ - *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); + if (comp_end - temp) { + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); + } else { + add_next_index_null(return_value); + } } while (inc_len 0); out: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
Work in progress, the code is very different there and the patch will be very different. Ilia Alshanetsky On 18-May-09, at 5:19 PM, Jani Taskinen wrote: What about HEAD? --Jani Ilia Alshanetsky kirjoitti: iliaa Mon May 18 18:45:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standardfile.c Log: Fixed bug #48313 (fgetcsv() does not return null for empty rows) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.32r2=1.409.2.6.2.28.2.33diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 php-src/ext/ standard/file.c:1.409.2.6.2.28.2.33 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 Fri May 8 09:44:17 2009 +++ php-src/ext/standard/file.c Mon May 18 18:45:30 2009 @@ -21,7 +21,7 @@ + --+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.32 2009/05/08 09:44:17 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.33 2009/05/18 18:45:30 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2343,8 +2343,12 @@ } /* 3. Now pass our field back to php */ - *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); + if (comp_end - temp) { + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); + } else { + add_next_index_null(return_value); + } } while (inc_len 0); out: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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) /ext/standard file.c
lbarnaudFri May 8 09:44:18 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fix invalid read http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.31r2=1.409.2.6.2.28.2.32diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.31 php-src/ext/standard/file.c:1.409.2.6.2.28.2.32 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.31 Sun Apr 19 17:10:34 2009 +++ php-src/ext/standard/file.c Fri May 8 09:44:17 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.31 2009/04/19 17:10:34 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.32 2009/05/08 09:44:17 lbarnaud Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -785,7 +785,7 @@ } else { do { int windows_eol = 0; - if (eol_marker == '\n' *(p - 1) == '\r') { + if (p != target_buf eol_marker == '\n' *(p - 1) == '\r') { windows_eol++; } if (skip_blank_lines !(p-s-windows_eol)) { -- 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) /ext/standard file.c streamsfuncs.c /main php_streams.h /main/streams cast.c streams.c
lbarnaudSun Apr 19 17:10:35 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/main php_streams.h /php-src/main/streams cast.c streams.c /php-src/ext/standard file.c streamsfuncs.c Log: MFH: Better fix for #47997 http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.103.2.1.2.4.2.9r2=1.103.2.1.2.4.2.10diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.103.2.1.2.4.2.9 php-src/main/php_streams.h:1.103.2.1.2.4.2.10 --- php-src/main/php_streams.h:1.103.2.1.2.4.2.9Sun Apr 19 13:46:47 2009 +++ php-src/main/php_streams.h Sun Apr 19 17:10:34 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.103.2.1.2.4.2.9 2009/04/19 13:46:47 lbarnaud Exp $ */ +/* $Id: php_streams.h,v 1.103.2.1.2.4.2.10 2009/04/19 17:10:34 lbarnaud Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -420,14 +420,12 @@ * Uses mmap if the src is a plain file and at offset 0 */ #define PHP_STREAM_COPY_ALL((size_t)-1) -#define PHP_STREAM_FAILURE ((size_t)-1) - BEGIN_EXTERN_C() ZEND_ATTRIBUTE_DEPRECATED PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); #define php_stream_copy_to_stream(src, dest, maxlen) _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC) -PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); -#define php_stream_copy_to_stream_ex(src, dest, maxlen) _php_stream_copy_to_stream_ex((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC) +PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC); +#define php_stream_copy_to_stream_ex(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC) /* read all data from stream and put into a buffer. Caller must free buffer when done. http://cvs.php.net/viewvc.cgi/php-src/main/streams/cast.c?r1=1.12.2.1.2.1.2.4r2=1.12.2.1.2.1.2.5diff_format=u Index: php-src/main/streams/cast.c diff -u php-src/main/streams/cast.c:1.12.2.1.2.1.2.4 php-src/main/streams/cast.c:1.12.2.1.2.1.2.5 --- php-src/main/streams/cast.c:1.12.2.1.2.1.2.4Sun Apr 19 13:46:47 2009 +++ php-src/main/streams/cast.c Sun Apr 19 17:10:34 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: cast.c,v 1.12.2.1.2.1.2.4 2009/04/19 13:46:47 lbarnaud Exp $ */ +/* $Id: cast.c,v 1.12.2.1.2.1.2.5 2009/04/19 17:10:34 lbarnaud Exp $ */ #define _GNU_SOURCE #include php.h @@ -214,9 +214,9 @@ newstream = php_stream_fopen_tmpfile(); if (newstream) { - size_t copied = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL); + int ret = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL); - if (copied == PHP_STREAM_FAILURE) { + if (ret != SUCCESS) { php_stream_close(newstream); } else { int retcode = php_stream_cast(newstream, castas | flags, ret, show_err); @@ -332,7 +332,7 @@ (*newstream)-open_lineno = origstream-open_lineno; #endif - if (php_stream_copy_to_stream_ex(origstream, *newstream, PHP_STREAM_COPY_ALL) == PHP_STREAM_FAILURE) { + if (php_stream_copy_to_stream_ex(origstream, *newstream, PHP_STREAM_COPY_ALL, NULL) != SUCCESS) { php_stream_close(*newstream); *newstream = NULL; return PHP_STREAM_CRITICAL; http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.18.2.25r2=1.82.2.6.2.18.2.26diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.82.2.6.2.18.2.25 php-src/main/streams/streams.c:1.82.2.6.2.18.2.26 --- php-src/main/streams/streams.c:1.82.2.6.2.18.2.25 Sun Apr 19 13:46:47 2009 +++ php-src/main/streams/streams.c Sun Apr 19 17:10:34 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.82.2.6.2.18.2.25 2009/04/19 13:46:47 lbarnaud Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.18.2.26 2009/04/19 17:10:34 lbarnaud Exp $ */ #define _GNU_SOURCE #include php.h @@ -1297,17 +1297,23 @@ return len; } -/* Returns the number of bytes moved, or PHP_STREAM_FAILURE on failure. */ -PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC) +/* Returns SUCCESS/FAILURE and sets *len to the number of bytes moved */ +PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c /ext/standard/tests/file fnmatch_basic.phpt fnmatch_error.phpt fnmatch_variation.phpt
pajoye Tue Jan 20 01:40:07 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/filefnmatch_basic.phpt fnmatch_error.phpt fnmatch_variation.phpt Log: - [DOC] add support for fnmatch() on Windows - enable tests (pass) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.28r2=1.409.2.6.2.28.2.29diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.28 php-src/ext/standard/file.c:1.409.2.6.2.28.2.29 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.28 Wed Dec 31 11:15:45 2008 +++ php-src/ext/standard/file.c Tue Jan 20 01:40:05 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.28 2008/12/31 11:15:45 sebastian Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.29 2009/01/20 01:40:05 pajoye Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -48,6 +48,7 @@ #define O_RDONLY _O_RDONLY #include win32/param.h #include win32/winutil.h +#include win32/fnmatch.h #elif defined(NETWARE) #include sys/param.h #include sys/select.h @@ -116,7 +117,7 @@ php_file_globals file_globals; #endif -#ifdef HAVE_FNMATCH +#if defined(HAVE_FNMATCH) !defined(PHP_WIN32) #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_basic.phpt?r1=1.1.2.2.2.2r2=1.1.2.2.2.3diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_basic.phpt diff -u php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.1.2.2.2.2 php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.1.2.2.2.3 --- php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.1.2.2.2.2 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_basic.phpt Tue Jan 20 01:40:06 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Basic functionality --SKIPIF-- ?php -if (substr(PHP_OS, 0, 3) == 'WIN') -die(skip do not run on Windows); - if (!function_exists('fnmatch')) die(skip fnmatch() function is not available); ? @@ -34,7 +31,7 @@ echo \n*** Done ***\n; ? ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file *** bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_error.phpt?r1=1.1.2.2.2.3r2=1.1.2.2.2.4diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_error.phpt diff -u php-src/ext/standard/tests/file/fnmatch_error.phpt:1.1.2.2.2.3 php-src/ext/standard/tests/file/fnmatch_error.phpt:1.1.2.2.2.4 --- php-src/ext/standard/tests/file/fnmatch_error.phpt:1.1.2.2.2.3 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_error.phpt Tue Jan 20 01:40:06 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Error conditions --SKIPIF-- ?php -if (substr(PHP_OS, 0, 3) == 'WIN') -die(skip do not run on Windows); - if (!function_exists('fnmatch')) die(skip fnmatch() function is not available); ? http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_variation.phpt?r1=1.1.2.2.2.3r2=1.1.2.2.2.4diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_variation.phpt diff -u php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.1.2.2.2.3 php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.1.2.2.2.4 --- php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.1.2.2.2.3 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_variation.phpt Tue Jan 20 01:40:06 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Variations --SKIPIF-- ?php -if (substr(PHP_OS, 0, 3) == 'WIN') -die(skip do not run on Windows); - if (!function_exists('fnmatch')) die(skip fnmatch() function is not available); ? @@ -18,6 +15,11 @@ echo *** Testing fnmatch() with file and various patterns ***\n; $file_name = dirname(__FILE__)./match.tmp; +/* avoid using \, it breaks the pattern */ +if (substr(PHP_OS, 0, 3) == 'WIN') { +$file_name = str_replace('\\','/', $file_name); +} + fopen($file_name, w); $pattern_arr = array( @@ -132,7 +134,7 @@ echo \n*** Done ***\n; ? ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true) -- 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) /ext/standard file.c
lstrojnySat Dec 13 15:06:20 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: One len variable is enough here, we can reuse it http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.26r2=1.409.2.6.2.28.2.27diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.26 php-src/ext/standard/file.c:1.409.2.6.2.28.2.27 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.26 Fri Dec 12 12:44:48 2008 +++ php-src/ext/standard/file.c Sat Dec 13 15:06:20 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.26 2008/12/12 12:44:48 bjori Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.27 2008/12/13 15:06:20 lstrojny Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -521,7 +521,7 @@ char *contents; zend_bool use_include_path = 0; php_stream *stream; - int len, newlen; + int len; long offset = -1; long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; @@ -556,8 +556,7 @@ if ((len = php_stream_copy_to_mem(stream, contents, maxlen, 0)) 0) { if (PG(magic_quotes_runtime)) { - contents = php_addslashes(contents, len, newlen, 1 TSRMLS_CC); /* 1 = free source string */ - len = newlen; + contents = php_addslashes(contents, len, len, 1 TSRMLS_CC); /* 1 = free source string */ } RETVAL_STRINGL(contents, len, 0); -- 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) /ext/standard file.c /ext/standard/tests/file mkdir_rmdir_variation2.phpt mkdir_variation1-win32.phpt mkdir_variation1.phpt mkdir_variation5.phpt
bjori Fri Dec 12 12:44:49 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/filemkdir_variation1.phpt mkdir_variation1-win32.phpt mkdir_variation5.phpt mkdir_rmdir_variation2.phpt Log: MFH: Fixed bug#46681 (mkdir() fails silently on PHP 5.3) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.25r2=1.409.2.6.2.28.2.26diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.25 php-src/ext/standard/file.c:1.409.2.6.2.28.2.26 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.25 Wed Nov 26 04:19:20 2008 +++ php-src/ext/standard/file.c Fri Dec 12 12:44:48 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.25 2008/11/26 04:19:20 lbarnaud Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.26 2008/12/12 12:44:48 bjori Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1355,7 +1355,7 @@ return -1; } - if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) 0 (options REPORT_ERRORS) == 1) { + if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) 0 (options REPORT_ERRORS)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, strerror(errno)); } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/mkdir_variation1.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u Index: php-src/ext/standard/tests/file/mkdir_variation1.phpt diff -u php-src/ext/standard/tests/file/mkdir_variation1.phpt:1.1.4.2 php-src/ext/standard/tests/file/mkdir_variation1.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/mkdir_variation1.phpt:1.1.4.2 Wed Nov 26 10:10:17 2008 +++ php-src/ext/standard/tests/file/mkdir_variation1.phpt Fri Dec 12 12:44:48 2008 @@ -2,7 +2,6 @@ Test mkdir() function : usage variation: try invalid pathname --CREDITS-- Dave Kelsey d_kel...@uk.ibm.com ---XFAIL-- --SKIPIF-- ?php if(substr(PHP_OS, 0, 3) == WIN) @@ -119,4 +118,4 @@ --single space-- directory created -===DONE=== \ No newline at end of file +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u Index: php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt diff -u php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt:1.1.4.2 php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt:1.1.4.2 Wed Nov 26 10:10:17 2008 +++ php-src/ext/standard/tests/file/mkdir_variation1-win32.phpt Fri Dec 12 12:44:48 2008 @@ -2,7 +2,6 @@ Test mkdir() function : usage variation: try invalid pathname --CREDITS-- Dave Kelsey d_kel...@uk.ibm.com ---XFAIL-- --SKIPIF-- ?php if(substr(PHP_OS, 0, 3) != WIN) @@ -120,4 +119,4 @@ --single space-- Error: 2 - mkdir(): %s, %s(%d) -===DONE=== \ No newline at end of file +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/mkdir_variation5.phpt?r1=1.1.4.2r2=1.1.4.3diff_format=u Index: php-src/ext/standard/tests/file/mkdir_variation5.phpt diff -u php-src/ext/standard/tests/file/mkdir_variation5.phpt:1.1.4.2 php-src/ext/standard/tests/file/mkdir_variation5.phpt:1.1.4.3 --- php-src/ext/standard/tests/file/mkdir_variation5.phpt:1.1.4.2 Wed Nov 26 10:10:17 2008 +++ php-src/ext/standard/tests/file/mkdir_variation5.phpt Fri Dec 12 12:44:48 2008 @@ -2,7 +2,6 @@ Test mkdir() function : variation: various valid and invalid paths --CREDITS-- Dave Kelsey d_kel...@uk.ibm.com ---XFAIL-- --SKIPIF-- ?php if(substr(PHP_OS, 0, 3) == WIN) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt?r1=1.1.2.2.2.1r2=1.1.2.2.2.2diff_format=u Index: php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt diff -u php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt:1.1.2.2.2.1 php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt:1.1.2.2.2.2 --- php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt:1.1.2.2.2.1 Mon Nov 5 17:43:21 2007 +++ php-src/ext/standard/tests/file/mkdir_rmdir_variation2.phpt Fri Dec 12 12:44:48 2008 @@ -70,6 +70,8 @@ *** Testing mkdir() with miscelleneous input *** bool(true) + +Warning: mkdir(): Permission denied in %sfile/mkdir_rmdir_variation2.php on line %d bool(false) bool(true) Done -- 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) /ext/standard file.c flock_compat.h /ext/standard/tests/file userstreams_004.phpt /main/streams userspace.c
lbarnaudWed Nov 26 04:19:20 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/fileuserstreams_004.phpt Modified files: /php-src/ext/standard file.c flock_compat.h /php-src/main/streams userspace.c Log: MFH: Fixed bug #46673 (stream_lock call with wrong paramater) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.24r2=1.409.2.6.2.28.2.25diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.24 php-src/ext/standard/file.c:1.409.2.6.2.28.2.25 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.24 Sun Nov 2 18:24:34 2008 +++ php-src/ext/standard/file.c Wed Nov 26 04:19:20 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.24 2008/11/02 18:24:34 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.25 2008/11/26 04:19:20 lbarnaud Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -193,10 +193,10 @@ REGISTER_LONG_CONSTANT(SEEK_SET, SEEK_SET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(SEEK_CUR, SEEK_CUR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(SEEK_END, SEEK_END, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(LOCK_SH, 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(LOCK_EX, 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(LOCK_UN, 3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(LOCK_NB, 4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(LOCK_SH, PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(LOCK_EX, PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(LOCK_UN, PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(LOCK_NB, PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_CONNECT, PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_AUTH_REQUIRED, PHP_STREAM_NOTIFY_AUTH_REQUIRED,CONST_CS | CONST_PERSISTENT); @@ -344,7 +344,7 @@ } /* flock_values contains all possible actions if (operation 4) we won't block on the lock */ - act = flock_values[act - 1] | (operation 4 ? LOCK_NB : 0); + act = flock_values[act - 1] | (operation PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { if (operation errno == EWOULDBLOCK arg3 PZVAL_IS_REF(arg3)) { Z_LVAL_P(arg3) = 1; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/flock_compat.h?r1=1.20.2.1.2.1.2.3r2=1.20.2.1.2.1.2.4diff_format=u Index: php-src/ext/standard/flock_compat.h diff -u php-src/ext/standard/flock_compat.h:1.20.2.1.2.1.2.3 php-src/ext/standard/flock_compat.h:1.20.2.1.2.1.2.4 --- php-src/ext/standard/flock_compat.h:1.20.2.1.2.1.2.3Sat Aug 23 20:21:08 2008 +++ php-src/ext/standard/flock_compat.h Wed Nov 26 04:19:20 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: flock_compat.h,v 1.20.2.1.2.1.2.3 2008/08/23 20:21:08 pajoye Exp $ */ +/* $Id: flock_compat.h,v 1.20.2.1.2.1.2.4 2008/11/26 04:19:20 lbarnaud Exp $ */ #ifndef FLOCK_COMPAT_H #define FLOCK_COMPAT_H @@ -35,6 +35,12 @@ PHPAPI int flock(int fd, int operation); #endif +/* Userland LOCK_* constants */ +#define PHP_LOCK_SH 1 +#define PHP_LOCK_EX 2 +#define PHP_LOCK_UN 3 +#define PHP_LOCK_NB 4 + #ifdef PHP_WIN32 #define EWOULDBLOCK WSAEWOULDBLOCK # define fsync _commit http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.31.2.3.2.7.2.5r2=1.31.2.3.2.7.2.6diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.31.2.3.2.7.2.5 php-src/main/streams/userspace.c:1.31.2.3.2.7.2.6 --- php-src/main/streams/userspace.c:1.31.2.3.2.7.2.5 Sat Nov 15 12:52:13 2008 +++ php-src/main/streams/userspace.cWed Nov 26 04:19:20 2008 @@ -17,11 +17,15 @@ +--+ */ -/* $Id: userspace.c,v 1.31.2.3.2.7.2.5 2008/11/15 12:52:13 lbarnaud Exp $ */ +/* $Id: userspace.c,v 1.31.2.3.2.7.2.6 2008/11/26 04:19:20 lbarnaud Exp $ */ #include php.h #include php_globals.h #include ext/standard/file.h +#include ext/standard/flock_compat.h +#ifdef HAVE_SYS_FILE_H +#include sys/file.h +#endif static int le_protocols; @@ -942,7 +946,23 @@ case PHP_STREAM_OPTION_LOCKING: MAKE_STD_ZVAL(zvalue); - ZVAL_LONG(zvalue, value); + ZVAL_LONG(zvalue, 0); + + if (value LOCK_NB) { + Z_LVAL_P(zvalue) |= PHP_LOCK_NB; + } + switch(value ~LOCK_NB) { + case LOCK_SH: +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c /ext/standard/tests/file fputcsv_002.phpt
felipe Fri Sep 12 01:14:14 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/filefputcsv_002.phpt Modified files: /php-src/ext/standard file.c Log: - MFH: Fixed unexpected zval changes http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.21r2=1.409.2.6.2.28.2.22diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.21 php-src/ext/standard/file.c:1.409.2.6.2.28.2.22 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.21 Tue Aug 12 19:38:54 2008 +++ php-src/ext/standard/file.c Fri Sep 12 01:14:14 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.21 2008/08/12 19:38:54 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.22 2008/09/12 01:14:14 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1866,7 +1866,7 @@ } /* }}} */ -#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL_PP(field), c, Z_STRLEN_PP(field)) +#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field)) /* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) Format line as CSV and write to file pointer */ @@ -1877,7 +1877,7 @@ const char escape_char = '\\'; php_stream *stream; int ret; - zval *fp = NULL, *fields = NULL, **field = NULL; + zval *fp = NULL, *fields = NULL, **field_tmp = NULL, field; char *delimiter_str = NULL, *enclosure_str = NULL; int delimiter_str_len, enclosure_str_len; HashPosition pos; @@ -1918,11 +1918,14 @@ count = zend_hash_num_elements(Z_ARRVAL_P(fields)); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(fields), pos); - while (zend_hash_get_current_data_ex(Z_ARRVAL_P(fields), (void **) field, pos) == SUCCESS) { - if (Z_TYPE_PP(field) != IS_STRING) { - SEPARATE_ZVAL(field); - convert_to_string(*field); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(fields), (void **) field_tmp, pos) == SUCCESS) { + field = **field_tmp; + + if (Z_TYPE_PP(field_tmp) != IS_STRING) { + zval_copy_ctor(field); + convert_to_string(field); } + /* enclose a field that contains a delimiter, an enclosure character, or a newline */ if (FPUTCSV_FLD_CHK(delimiter) || FPUTCSV_FLD_CHK(enclosure) || @@ -1932,8 +1935,8 @@ FPUTCSV_FLD_CHK('\t') || FPUTCSV_FLD_CHK(' ') ) { - char *ch = Z_STRVAL_PP(field); - char *end = ch + Z_STRLEN_PP(field); + char *ch = Z_STRVAL(field); + char *end = ch + Z_STRLEN(field); int escaped = 0; smart_str_appendc(csvline, enclosure); @@ -1950,13 +1953,17 @@ } smart_str_appendc(csvline, enclosure); } else { - smart_str_appendl(csvline, Z_STRVAL_PP(field), Z_STRLEN_PP(field)); + smart_str_appendl(csvline, Z_STRVAL(field), Z_STRLEN(field)); } if (++i != count) { smart_str_appendl(csvline, delimiter, 1); } zend_hash_move_forward_ex(Z_ARRVAL_P(fields), pos); + + if (Z_TYPE_PP(field_tmp) != IS_STRING) { + zval_dtor(field); + } } smart_str_appendc(csvline, '\n'); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fputcsv_002.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/file/fputcsv_002.phpt +++ php-src/ext/standard/tests/file/fputcsv_002.phpt --TEST-- fputcsv(): Checking data after calling the function --FILE-- ?php $file = dirname(__FILE__) .'/fgetcsv-test.csv'; $data = array(1, 2, 'foo', 'haha', array(4, 5, 6), 1.3, null); $fp = fopen($file, 'w'); fputcsv($fp, $data); var_dump($data); @unlink($file); ? --EXPECTF-- Notice: Array to string conversion in %s on line %d array(7) { [0]= int(1) [1]= int(2) [2]= unicode(3) foo [3]= unicode(4) haha [4]= array(3) { [0]= int(4) [1]= int(5) [2]= int(6) } [5]= float(1.3) [6]= NULL } -- 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) /ext/standard file.c /ext/standard/tests/file fscanf.phpt fscanf_error.phpt
felipe Tue Aug 12 19:38:55 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/filefscanf.phpt fscanf_error.phpt Log: - New parameter parsing API (for fscanf) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.20r2=1.409.2.6.2.28.2.21diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.20 php-src/ext/standard/file.c:1.409.2.6.2.28.2.21 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.20 Mon Aug 11 13:11:30 2008 +++ php-src/ext/standard/file.c Tue Aug 12 19:38:54 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.20 2008/08/11 13:11:30 pajoye Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.21 2008/08/12 19:38:54 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1168,30 +1168,18 @@ Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result; - zval **file_handle, **format_string; + int result, format_len, type, argc = 0; + zval ***args = NULL; + zval *file_handle; + char *buf, *format; size_t len; - int type; - char *buf; void *what; - - zval ***args; - int argCount; - - argCount = ZEND_NUM_ARGS(); - if (argCount 2) { - WRONG_PARAM_COUNT; - } - args = (zval ***)safe_emalloc(argCount, sizeof(zval **), 0); - if (zend_get_parameters_array_ex(argCount, args) == FAILURE) { - efree( args ); - WRONG_PARAM_COUNT; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs*, file_handle, format, format_len, args, argc) == FAILURE) { + return; } - file_handle = args[0]; - format_string = args[1]; - - what = zend_fetch_resource(file_handle TSRMLS_CC, -1, File-Handle, type, 2, php_file_le_stream(), php_file_le_pstream()); + what = zend_fetch_resource(file_handle TSRMLS_CC, -1, File-Handle, type, 2, php_file_le_stream(), php_file_le_pstream()); /* * we can't do a ZEND_VERIFY_RESOURCE(what), otherwise we end up @@ -1199,26 +1187,30 @@ * if the code behind ZEND_VERIFY_RESOURCE changed. - cc */ if (!what) { - efree(args); + if (args) { + efree(args); + } RETURN_FALSE; } buf = php_stream_get_line((php_stream *) what, NULL, 0, len); if (buf == NULL) { - efree(args); + if (args) { + efree(args); + } RETURN_FALSE; } - convert_to_string_ex(format_string); - result = php_sscanf_internal(buf, Z_STRVAL_PP(format_string), argCount, args, 2, return_value TSRMLS_CC); + result = php_sscanf_internal(buf, format, argc, args, 0, return_value TSRMLS_CC); - efree(args); + if (args) { + efree(args); + } efree(buf); if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { WRONG_PARAM_COUNT; } - } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fscanf.phpt?r1=1.1.2.2.2.1r2=1.1.2.2.2.2diff_format=u Index: php-src/ext/standard/tests/file/fscanf.phpt diff -u php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.1 php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.2 --- php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.1 Mon Nov 5 17:43:20 2007 +++ php-src/ext/standard/tests/file/fscanf.phpt Tue Aug 12 19:38:54 2008 @@ -60,14 +60,14 @@ echo Done\n; ? --EXPECTF-- -Warning: Wrong parameter count for fscanf() in %s on line %d +Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d NULL -Warning: Wrong parameter count for fscanf() in %s on line %d +Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d NULL -Warning: fscanf(): supplied argument is not a valid File-Handle resource in %s on line %d -bool(false) +Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d +NULL int(0) NULL int(1) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fscanf_error.phpt?r1=1.1.2.1.2.1r2=1.1.2.1.2.2diff_format=u Index: php-src/ext/standard/tests/file/fscanf_error.phpt diff -u php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.1 php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.2 --- php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.1 Mon Nov 5 17:43:20 2007 +++ php-src/ext/standard/tests/file/fscanf_error.phpt Tue Aug 12 19:38:54 2008 @@ -64,13 +64,13 @@ --EXPECTF-- *** Testing fscanf() for error conditions *** -Warning: Wrong parameter count for fscanf() in %s on line %d +Warning: fscanf() expects at least 2 parameters, 0 given in
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c /ext/standard/tests/file fscanf.phpt fscanf_error.phpt
Hello Felipe, Tuesday, August 12, 2008, 9:38:55 PM, you wrote: felipe Tue Aug 12 19:38:55 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/filefscanf.phpt fscanf_error.phpt Log: - New parameter parsing API (for fscanf) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.20r2=1.409.2.6.2.28.2.21diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.20 php-src/ext/standard/file.c:1.409.2.6.2.28.2.21 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.20 Mon Aug 11 13:11:30 2008 +++ php-src/ext/standard/file.c Tue Aug 12 19:38:54 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.20 2008/08/11 13:11:30 pajoye Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.21 2008/08/12 19:38:54 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1168,30 +1168,18 @@ Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result; - zval **file_handle, **format_string; + int result, format_len, type, argc = 0; + zval ***args = NULL; + zval *file_handle; + char *buf, *format; size_t len; - int type; - char *buf; void *what; - - zval ***args; - int argCount; - - argCount = ZEND_NUM_ARGS(); - if (argCount 2) { - WRONG_PARAM_COUNT; - } - args = (zval ***)safe_emalloc(argCount, sizeof(zval **), 0); - if (zend_get_parameters_array_ex(argCount, args) == FAILURE) { - efree( args ); - WRONG_PARAM_COUNT; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs*, file_handle, format, format_len, args, argc) == FAILURE) { + return; } - file_handle = args[0]; - format_string = args[1]; - - what = zend_fetch_resource(file_handle TSRMLS_CC, -1, File-Handle, type, 2, php_file_le_stream(), php_file_le_pstream()); + what = zend_fetch_resource(file_handle TSRMLS_CC, -1, File-Handle, type, 2, php_file_le_stream(), php_file_le_pstream()); /* * we can't do a ZEND_VERIFY_RESOURCE(what), otherwise we end up @@ -1199,26 +1187,30 @@ * if the code behind ZEND_VERIFY_RESOURCE changed. - cc */ if (!what) { - efree(args); + if (args) { + efree(args); + } RETURN_FALSE; } buf = php_stream_get_line((php_stream *) what, NULL, 0, len); if (buf == NULL) { - efree(args); + if (args) { + efree(args); + } RETURN_FALSE; } - convert_to_string_ex(format_string); - result = php_sscanf_internal(buf, Z_STRVAL_PP(format_string), argCount, args, 2, return_value TSRMLS_CC); + result = php_sscanf_internal(buf, format, argc, args, 0, return_value TSRMLS_CC); - efree(args); + if (args) { + efree(args); + } efree(buf); if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { WRONG_PARAM_COUNT; } - } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fscanf.phpt?r1=1.1.2.2.2.1r2=1.1.2.2.2.2diff_format=u Index: php-src/ext/standard/tests/file/fscanf.phpt diff -u php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.1 php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.2 --- php-src/ext/standard/tests/file/fscanf.phpt:1.1.2.2.2.1 Mon Nov 5 17:43:20 2007 +++ php-src/ext/standard/tests/file/fscanf.phpt Tue Aug 12 19:38:54 2008 @@ -60,14 +60,14 @@ echo Done\n; ? --EXPECTF-- -Warning: Wrong parameter count for fscanf() in %s on line %d +Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d NULL -Warning: Wrong parameter count for fscanf() in %s on line %d +Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d NULL -Warning: fscanf(): supplied argument is not a valid File-Handle resource in %s on line %d -bool(false) +Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d +NULL int(0) NULL int(1) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fscanf_error.phpt?r1=1.1.2.1.2.1r2=1.1.2.1.2.2diff_format=u Index: php-src/ext/standard/tests/file/fscanf_error.phpt diff -u php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.1 php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.2 --- php-src/ext/standard/tests/file/fscanf_error.phpt:1.1.2.1.2.1 Mon Nov 5 17:43:20 2007 +++ php-src/ext/standard/tests/file/fscanf_error.phpt Tue Aug 12
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c /ext/standard/tests/file fscanf.phpt fscanf_error.phpt
Em Ter, 2008-08-12 às 21:46 +0200, Marcus Boerger escreveu: Hello Felipe, Tuesday, August 12, 2008, 9:38:55 PM, you wrote: -Warning: fscanf(): %d is not a valid File-Handle resource in %s on line %d +Warning: fscanf(): 6 is not a valid File-Handle resource in %s on line %d Verifying the resource number is a bad idea here. Op! :D Thanks. -- Regards, Felipe Pena. -- 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) /ext/standard file.c /ext/standard/tests/file copy_variation4-win32.phpt copy_variation4.phpt
pajoye Mon Aug 11 13:11:31 2008 UTC Removed files: (Branch: PHP_5_3) /php-src/ext/standard/tests/filecopy_variation4-win32.phpt Modified files: /php-src/ext/standard file.c /php-src/ext/standard/tests/filecopy_variation4.phpt Log: - [DOC] MFH: detect if dest is a dir (if the given stream layer supports stat) and fails . remove win32 specific test. The errors are not the same http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.19r2=1.409.2.6.2.28.2.20diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.19 php-src/ext/standard/file.c:1.409.2.6.2.28.2.20 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.19 Wed Jul 23 11:25:14 2008 +++ php-src/ext/standard/file.c Mon Aug 11 13:11:30 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.19 2008/07/23 11:25:14 tony2001 Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.20 2008/08/11 13:11:30 pajoye Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1731,8 +1731,20 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, The first argument to copy() function cannot be a directory); return FAILURE; } - if (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, dest_s, NULL) != 0) { - goto safe_to_copy; + + switch (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, dest_s, NULL)) { + case -1: + /* non-statable stream */ + goto safe_to_copy; + break; + case 0: + break; + default: /* failed to stat file, does not exist? */ + return ret; + } + if (S_ISDIR(dest_s.sb.st_mode)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, The second argument to copy() function cannot be a directory); + return FAILURE; } if (!src_s.sb.st_ino || !dest_s.sb.st_ino) { goto no_stat; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/copy_variation4.phpt?r1=1.1.2.2.2.4r2=1.1.2.2.2.5diff_format=u Index: php-src/ext/standard/tests/file/copy_variation4.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) /ext/standard file.c fsock.c proc_open.c streamsfuncs.c /ext/standard/tests/file fscanf_variation10.phpt fscanf_variation16.phpt fscanf_variation22.phpt fscanf_variati
felipe Tue Jul 22 14:09:24 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c fsock.c proc_open.c streamsfuncs.c /php-src/ext/standard/tests/filefscanf_variation10.phpt fscanf_variation16.phpt fscanf_variation22.phpt fscanf_variation29.phpt fscanf_variation35.phpt fscanf_variation4.phpt fscanf_variation41.phpt fscanf_variation47.phpt /php-src/main php_streams.h /php-src/sapi/cli php_cli.c Log: - MFH: Fixed bug #44246 (closedir() accepts a file resource opened by fopen()) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.17r2=1.409.2.6.2.28.2.18diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.17 php-src/ext/standard/file.c:1.409.2.6.2.28.2.18 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.17 Mon Jul 21 11:46:18 2008 +++ php-src/ext/standard/file.c Tue Jul 22 14:09:24 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.17 2008/07/21 11:46:18 jani Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.18 2008/07/22 14:09:24 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -856,6 +856,8 @@ stream = php_stream_fopen_tmpfile(); if (stream) { + stream-flags |= PHP_STREAM_FLAG_FCLOSE; + php_stream_to_zval(stream, return_value); } else { RETURN_FALSE; @@ -885,6 +887,8 @@ if (stream == NULL) { RETURN_FALSE; } + + stream-flags |= PHP_STREAM_FLAG_FCLOSE; php_stream_to_zval(stream, return_value); } @@ -902,6 +906,12 @@ } PHP_STREAM_TO_ZVAL(stream, arg1); + + if (!(stream-flags PHP_STREAM_FLAG_FCLOSE)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, %d is not a valid stream resource, stream-rsrc_id); + RETURN_FALSE; + } + if (!stream-is_persistent) { zend_list_delete(stream-rsrc_id); } else { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/fsock.c?r1=1.121.2.1.2.1.2.1r2=1.121.2.1.2.1.2.2diff_format=u Index: php-src/ext/standard/fsock.c diff -u php-src/ext/standard/fsock.c:1.121.2.1.2.1.2.1 php-src/ext/standard/fsock.c:1.121.2.1.2.1.2.2 --- php-src/ext/standard/fsock.c:1.121.2.1.2.1.2.1 Mon Dec 31 07:17:14 2007 +++ php-src/ext/standard/fsock.cTue Jul 22 14:09:24 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: fsock.c,v 1.121.2.1.2.1.2.1 2007/12/31 07:17:14 sebastian Exp $ */ +/* $Id: fsock.c,v 1.121.2.1.2.1.2.2 2008/07/22 14:09:24 felipe Exp $ */ #include php.h #include php_globals.h @@ -79,6 +79,8 @@ stream = php_stream_xport_create(hostname, hostname_len, ENFORCE_SAFE_MODE | REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, tv, NULL, errstr, err); + stream-flags |= PHP_STREAM_FLAG_FCLOSE; + if (port 0) { efree(hostname); } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.17.2.2r2=1.36.2.1.2.17.2.3diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.17.2.2 php-src/ext/standard/proc_open.c:1.36.2.1.2.17.2.3 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.17.2.2 Tue Apr 8 08:42:24 2008 +++ php-src/ext/standard/proc_open.cTue Jul 22 14:09:24 2008 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.17.2.2 2008/04/08 08:42:24 jani Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.17.2.3 2008/07/22 14:09:24 felipe Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -969,7 +969,7 @@ zval *retfp; /* nasty hack; don't copy it */ - stream-flags |= PHP_STREAM_FLAG_NO_SEEK; + stream-flags |= PHP_STREAM_FLAG_NO_SEEK | PHP_STREAM_FLAG_FCLOSE; MAKE_STD_ZVAL(retfp); php_stream_to_zval(stream, retfp); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.15.2.17r2=1.58.2.6.2.15.2.18diff_format=u Index:
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
janiMon Jul 21 11:46:18 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: - Forward compatibility. # @DOC@, [DOC], *DOC*: Added FILE_TEXT and FILE_BINARY constants for forward compatibility. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.16r2=1.409.2.6.2.28.2.17diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.16 php-src/ext/standard/file.c:1.409.2.6.2.28.2.17 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.16 Fri Jul 11 10:25:15 2008 +++ php-src/ext/standard/file.c Mon Jul 21 11:46:18 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.16 2008/07/11 10:25:15 tony2001 Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.17 2008/07/21 11:46:18 jani Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -290,6 +290,9 @@ REGISTER_LONG_CONSTANT(FILE_APPEND, PHP_FILE_APPEND,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FILE_NO_DEFAULT_CONTEXT, PHP_FILE_NO_DEFAULT_CONTEXT,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(FILE_TEXT, 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(FILE_BINARY, 0, CONST_CS | CONST_PERSISTENT); + #ifdef HAVE_FNMATCH REGISTER_LONG_CONSTANT(FNM_NOESCAPE, FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FNM_PATHNAME, FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); -- 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) /ext/standard file.c /ext/standard/tests/file 007_error.phpt fflush_error.phpt fgetc_error.phpt fgetc_variation2.phpt fgets_error.phpt fgets_variation2.phpt fgetss_err
ohill Thu Jul 3 20:19:27 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/file007_error.phpt fflush_error.phpt fgetc_error.phpt fgetc_variation2.phpt fgets_error.phpt fgets_variation2.phpt fgetss_error.phpt fpassthru_error.phpt fread_error.phpt fseek_ftell_rewind_error1.phpt fseek_ftell_rewind_error2.phpt fseek_ftell_rewind_error3.phpt ftruncate_error.phpt fwrite.phpt fwrite_error.phpt popen_pclose_error.phpt umask_error.phpt Log: New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.14r2=1.409.2.6.2.28.2.15diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.14 php-src/ext/standard/file.c:1.409.2.6.2.28.2.15 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.14 Fri May 16 12:44:11 2008 +++ php-src/ext/standard/file.c Thu Jul 3 20:19:26 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.14 2008/05/16 12:44:11 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.15 2008/07/03 20:19:26 ohill Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -895,14 +895,14 @@ Close an open file pointer */ PHPAPI PHP_FUNCTION(fclose) { - zval **arg1; + zval *arg1; php_stream *stream; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg1) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, arg1) == FAILURE) { + RETURN_FALSE; } - - PHP_STREAM_TO_ZVAL(stream, arg1); + + PHP_STREAM_TO_ZVAL(stream, arg1); if (!stream-is_persistent) { zend_list_delete(stream-rsrc_id); } else { @@ -996,14 +996,14 @@ Close a file pointer opened by popen() */ PHP_FUNCTION(pclose) { - zval **arg1; + zval *arg1; php_stream *stream; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg1) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, arg1) == FAILURE) { + RETURN_FALSE; } - PHP_STREAM_TO_ZVAL(stream, arg1); + PHP_STREAM_TO_ZVAL(stream, arg1); zend_list_delete(stream-rsrc_id); RETURN_LONG(FG(pclose_ret)); @@ -1014,14 +1014,14 @@ Test for end-of-file on a file pointer */ PHPAPI PHP_FUNCTION(feof) { - zval **arg1; + zval *arg1; php_stream *stream; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg1) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, arg1) == FAILURE) { + RETURN_FALSE; } - PHP_STREAM_TO_ZVAL(stream, arg1); + PHP_STREAM_TO_ZVAL(stream, arg1); if (php_stream_eof(stream)) { RETURN_TRUE; @@ -1035,18 +1035,18 @@ Get a line from file pointer */ PHPAPI PHP_FUNCTION(fgets) { - zval **arg1, **arg2; - int len = 1024; + zval *arg1; + long len = 1024; char *buf = NULL; int argc = ZEND_NUM_ARGS(); size_t line_len = 0; php_stream *stream; - if (argc 1 || argc 2 || zend_get_parameters_ex(argc, arg1, arg2) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|l, arg1, len) == FAILURE) { + RETURN_FALSE; } - PHP_STREAM_TO_ZVAL(stream, arg1); + PHP_STREAM_TO_ZVAL(stream, arg1); if (argc == 1) { /* ask streams to give us a buffer of an appropriate size */ @@ -1055,9 +1055,6 @@ goto exit_failed; } } else if (argc 1) { - convert_to_long_ex(arg2); - len = Z_LVAL_PP(arg2); - if (len = 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter must be greater than 0); RETURN_FALSE; @@ -1094,16 +1091,16 @@ Get a character from file pointer */ PHPAPI PHP_FUNCTION(fgetc) { - zval **arg1; + zval *arg1; char buf[2]; int result; php_stream *stream; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg1) ==
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
felipe Fri May 16 12:44:11 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: - Changed 'Z' to 's' (parameter parsing), the code didn't check if the parameter is a string. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.13r2=1.409.2.6.2.28.2.14diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.13 php-src/ext/standard/file.c:1.409.2.6.2.28.2.14 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.13 Sun May 4 21:17:32 2008 +++ php-src/ext/standard/file.c Fri May 16 12:44:11 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.13 2008/05/04 21:17:32 colder Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.14 2008/05/16 12:44:11 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1717,24 +1717,26 @@ Copy a file */ PHP_FUNCTION(copy) { - zval **source, **target, *zcontext = NULL; + char *source, *target; + int source_len, target_len; + zval *zcontext = NULL; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ZZ|r, source, target, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|r, source, source_len, target, target_len, zcontext) == FAILURE) { return; } - if (PG(safe_mode) (!php_checkuid(Z_STRVAL_PP(source), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + if (PG(safe_mode) (!php_checkuid(source, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } - if (php_check_open_basedir(Z_STRVAL_PP(source) TSRMLS_CC)) { + if (php_check_open_basedir(source TSRMLS_CC)) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); - if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target) TSRMLS_CC) == SUCCESS) { + if (php_copy_file(source, target TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } else { RETURN_FALSE; -- 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) /ext/standard file.c
iliaa Sun Mar 30 15:05:49 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Added a warning message http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.10r2=1.409.2.6.2.28.2.11diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.10 php-src/ext/standard/file.c:1.409.2.6.2.28.2.11 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.10 Wed Mar 26 23:06:47 2008 +++ php-src/ext/standard/file.c Sun Mar 30 15:05:48 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.10 2008/03/26 23:06:47 iliaa Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.11 2008/03/30 15:05:48 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -614,6 +614,7 @@ if (flags LOCK_EX (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) { php_stream_close(stream); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Exclusive locks are not supported for this stream); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
Can't you check with php_stream_supports_lock here wether the stream- wrapper supports locking? regards, Benjamin On 27.03.2008, at 00:06, Ilia Alshanetsky wrote: iliaa Wed Mar 26 23:06:48 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standardfile.c Log: Fixed bug #44501 (LOCK_EX mode in file_put_contents() is impropertly handled in combination with url wrappers) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.9r2=1.409.2.6.2.28.2.10diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 php-src/ext/ standard/file.c:1.409.2.6.2.28.2.10 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 Sun Feb 24 11:45:55 2008 +++ php-src/ext/standard/file.c Wed Mar 26 23:06:47 2008 @@ -21,7 +21,7 @@ + --+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.9 2008/02/24 11:45:55 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.10 2008/03/26 23:06:47 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -596,6 +596,13 @@ if (flags PHP_FILE_APPEND) { mode[0] = 'a'; } else if (flags LOCK_EX) { + /* check to make sure we are dealing with a regular file */ + if (php_memnstr(filename, ://, sizeof(://) - 1, filename + filename_len)) { + if (strncasecmp(filename, file://, sizeof(file://) - 1)) { +php_error_docref(NULL TSRMLS_CC, E_WARNING, Exclusive locks may only be set for regular files); + RETURN_FALSE; + } + } mode[0] = 'c'; } mode[2] = '\0'; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
On 27.03.2008 10:15, Benjamin Schulz wrote: Can't you check with php_stream_supports_lock here wether the stream- wrapper supports locking? I agree, that would make much more sense. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
Can't you check with php_stream_supports_lock here wether the stream-wrapper supports locking? That requires an open stream. And why don't you raise the warning after opening the stream? There is this check anyway: if (flags LOCK_EX (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) { php_stream_close(stream); RETURN_FALSE; } On 27-Mar-08, at 3:15 AM, Benjamin Schulz wrote: regards, Benjamin On 27.03.2008, at 00:06, Ilia Alshanetsky wrote: iliaa Wed Mar 26 23:06:48 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fixed bug #44501 (LOCK_EX mode in file_put_contents() is impropertly handled in combination with url wrappers) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.9r2=1.409.2.6.2.28.2.10diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 php-src/ext/ standard/file.c:1.409.2.6.2.28.2.10 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 Sun Feb 24 11:45:55 2008 +++ php-src/ext/standard/file.c Wed Mar 26 23:06:47 2008 @@ -21,7 +21,7 @@ + --+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.9 2008/02/24 11:45:55 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.10 2008/03/26 23:06:47 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -596,6 +596,13 @@ if (flags PHP_FILE_APPEND) { mode[0] = 'a'; } else if (flags LOCK_EX) { + /* check to make sure we are dealing with a regular file */ + if (php_memnstr(filename, ://, sizeof(://) - 1, filename + filename_len)) { + if (strncasecmp(filename, file://, sizeof(file://) - 1)) { +php_error_docref(NULL TSRMLS_CC, E_WARNING, Exclusive locks may only be set for regular files); + RETURN_FALSE; + } + } mode[0] = 'c'; } mode[2] = '\0'; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ilia Alshanetsky -- 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) /ext/standard file.c
iliaa Wed Mar 26 23:06:48 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fixed bug #44501 (LOCK_EX mode in file_put_contents() is impropertly handled in combination with url wrappers) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.9r2=1.409.2.6.2.28.2.10diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 php-src/ext/standard/file.c:1.409.2.6.2.28.2.10 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 Sun Feb 24 11:45:55 2008 +++ php-src/ext/standard/file.c Wed Mar 26 23:06:47 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.9 2008/02/24 11:45:55 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.10 2008/03/26 23:06:47 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -596,6 +596,13 @@ if (flags PHP_FILE_APPEND) { mode[0] = 'a'; } else if (flags LOCK_EX) { + /* check to make sure we are dealing with a regular file */ + if (php_memnstr(filename, ://, sizeof(://) - 1, filename + filename_len)) { + if (strncasecmp(filename, file://, sizeof(file://) - 1)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Exclusive locks may only be set for regular files); + RETURN_FALSE; + } + } mode[0] = 'c'; } mode[2] = '\0'; -- 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) /ext/standard file.c
felipe Sun Feb 24 11:45:55 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Removed internal warning http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.8r2=1.409.2.6.2.28.2.9diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.8 php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.8 Sat Feb 23 17:06:21 2008 +++ php-src/ext/standard/file.c Sun Feb 24 11:45:55 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.8 2008/02/23 17:06:21 helly Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.9 2008/02/24 11:45:55 felipe Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1382,8 +1382,6 @@ { int ret; - php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, This function is deprecated; use php_stream_mkdir() instead.); - if (PG(safe_mode) (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { return -1; } -- 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) /ext/standard file.c
tony2001Tue Nov 13 10:31:25 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: fix typo (nice catch, Nuno!) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.5r2=1.409.2.6.2.28.2.6diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.5 php-src/ext/standard/file.c:1.409.2.6.2.28.2.6 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.5 Mon Nov 12 18:44:18 2007 +++ php-src/ext/standard/file.c Tue Nov 13 10:31:24 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.5 2007/11/12 18:44:18 iliaa Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.6 2007/11/13 10:31:24 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -610,7 +610,7 @@ RETURN_FALSE; } - if (mode[0] = 'c') { + if (mode[0] == 'c') { php_stream_truncate_set_size(stream, 0); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
Thanks for the typo catch fix. On 13-Nov-07, at 5:31 AM, Antony Dovgal wrote: tony2001Tue Nov 13 10:31:25 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standardfile.c Log: fix typo (nice catch, Nuno!) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.5r2=1.409.2.6.2.28.2.6diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.5 php-src/ext/ standard/file.c:1.409.2.6.2.28.2.6 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.5 Mon Nov 12 18:44:18 2007 +++ php-src/ext/standard/file.c Tue Nov 13 10:31:24 2007 @@ -21,7 +21,7 @@ + --+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.5 2007/11/12 18:44:18 iliaa Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.6 2007/11/13 10:31:24 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -610,7 +610,7 @@ RETURN_FALSE; } - if (mode[0] = 'c') { + if (mode[0] == 'c') { php_stream_truncate_set_size(stream, 0); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ilia Alshanetsky -- 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) /ext/standard file.c /main/streams plain_wrapper.c
iliaa Mon Nov 12 18:44:18 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/main/streams plain_wrapper.c /php-src/ext/standard file.c Log: Fixed bug #43182 (file_put_contents() LOCK_EX does not work properly on file truncation). http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.23.2.3r2=1.52.2.6.2.23.2.4diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23.2.3 php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23.2.4 --- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23.2.3 Tue Nov 6 12:12:58 2007 +++ php-src/main/streams/plain_wrapper.cMon Nov 12 18:44:18 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.23.2.3 2007/11/06 12:12:58 helly Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.23.2.4 2007/11/12 18:44:18 iliaa Exp $ */ #include php.h #include php_globals.h @@ -63,6 +63,9 @@ case 'x': flags = O_CREAT|O_EXCL; break; + case 'c': + flags = O_CREAT; + break; default: /* unknown mode */ return FAILURE; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.4r2=1.409.2.6.2.28.2.5diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.4 php-src/ext/standard/file.c:1.409.2.6.2.28.2.5 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.4 Fri Nov 9 11:08:22 2007 +++ php-src/ext/standard/file.c Mon Nov 12 18:44:18 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.4 2007/11/09 11:08:22 dmitry Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.5 2007/11/12 18:44:18 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -581,6 +581,7 @@ zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; + char mode[3] = wb; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sz/|lr!, filename, filename_len, data, flags, zcontext) == FAILURE) { return; @@ -592,8 +593,14 @@ context = php_stream_context_from_zval(zcontext, flags PHP_FILE_NO_DEFAULT_CONTEXT); - stream = php_stream_open_wrapper_ex(filename, (flags PHP_FILE_APPEND) ? ab : wb, - ((flags PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); + if (flags PHP_FILE_APPEND) { + mode[0] = 'a'; + } else if (flags LOCK_EX) { + mode[0] = 'c'; + } + mode[2] = '\0'; + + stream = php_stream_open_wrapper_ex(filename, mode, ((flags PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); if (stream == NULL) { RETURN_FALSE; } @@ -603,6 +610,10 @@ RETURN_FALSE; } + if (mode[0] = 'c') { + php_stream_truncate_set_size(stream, 0); + } + switch (Z_TYPE_P(data)) { case IS_RESOURCE: numbytes = php_stream_copy_to_stream(srcstream, stream, PHP_STREAM_COPY_ALL); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c /main/streams plain_wrapper.c
Hi Ilia, + char mode[3] = wb; + if (flags PHP_FILE_APPEND) { + mode[0] = 'a'; + } else if (flags LOCK_EX) { + mode[0] = 'c'; uhm, I think this assignment isn't needed, as the variable should already contain the '\0' from the initilization above. + mode[2] = '\0'; probably you meant == 'c' here + if (mode[0] = 'c') { + php_stream_truncate_set_size(stream, 0); + } Nuno -- 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) /ext/standard file.c
dmitry Fri Nov 9 11:08:23 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Conditions optimization http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.3r2=1.409.2.6.2.28.2.4diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.3 php-src/ext/standard/file.c:1.409.2.6.2.28.2.4 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.3 Tue Nov 6 17:11:56 2007 +++ php-src/ext/standard/file.c Fri Nov 9 11:08:22 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.3 2007/11/06 17:11:56 jani Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.4 2007/11/09 11:08:22 dmitry Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2244,11 +2244,10 @@ state = 0; break; default: - if ((escape_char == enclosure *bptr == escape_char *(bptr+1) == escape_char) - || (escape_char != enclosure *bptr == escape_char)) { - state = 1; - } else if (*bptr == enclosure) { + if (*bptr == enclosure) { state = 2; + } else if (*bptr == escape_char) { + state = 1; } bptr++; break; -- 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) /ext/standard file.c link.c /ext/standard/tests/file fgetc_variation2.phpt readlink_realpath_error.phpt symlink_link_linkinfo_is_link_error1.phpt symlink_link_linkinfo
janiTue Nov 6 17:11:57 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c link.c /php-src/ext/standard/tests/filefgetc_variation2.phpt readlink_realpath_error.phpt symlink_link_linkinfo_is_link_error1.phpt symlink_link_linkinfo_is_link_error2.phpt Log: MFH: sync http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.2r2=1.409.2.6.2.28.2.3diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.2 php-src/ext/standard/file.c:1.409.2.6.2.28.2.3 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.2 Mon Nov 5 17:43:04 2007 +++ php-src/ext/standard/file.c Tue Nov 6 17:11:56 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.2 2007/11/05 17:43:04 jani Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.3 2007/11/06 17:11:56 jani Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2358,16 +2358,15 @@ Return the resolved path */ PHP_FUNCTION(realpath) { - zval **path; + char *filename; + int filename_len; char resolved_path_buff[MAXPATHLEN]; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), path) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, filename, filename_len) == FAILURE) { + return; } - convert_to_string_ex(path); - - if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) { + if (VCWD_REALPATH(filename, resolved_path_buff)) { if (PG(safe_mode) (!php_checkuid(resolved_path_buff, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/link.c?r1=1.52.2.1.2.3r2=1.52.2.1.2.3.2.1diff_format=u Index: php-src/ext/standard/link.c diff -u php-src/ext/standard/link.c:1.52.2.1.2.3 php-src/ext/standard/link.c:1.52.2.1.2.3.2.1 --- php-src/ext/standard/link.c:1.52.2.1.2.3Tue Jul 10 13:21:11 2007 +++ php-src/ext/standard/link.c Tue Nov 6 17:11:56 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: link.c,v 1.52.2.1.2.3 2007/07/10 13:21:11 dmitry Exp $ */ +/* $Id: link.c,v 1.52.2.1.2.3.2.1 2007/11/06 17:11:56 jani Exp $ */ #include php.h #include php_filestat.h @@ -54,24 +54,24 @@ Return the target of a symbolic link */ PHP_FUNCTION(readlink) { - zval **filename; + char *link; + int link_len; char buff[MAXPATHLEN]; int ret; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, filename) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, link, link_len) == FAILURE) { + return; } - convert_to_string_ex(filename); - if (PG(safe_mode) !php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR)) { + if (PG(safe_mode) !php_checkuid(link, NULL, CHECKUID_CHECK_FILE_AND_DIR)) { RETURN_FALSE; } - if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { + if (php_check_open_basedir(link TSRMLS_CC)) { RETURN_FALSE; } - ret = readlink(Z_STRVAL_PP(filename), buff, MAXPATHLEN-1); + ret = readlink(link, buff, MAXPATHLEN-1); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, strerror(errno)); @@ -88,16 +88,16 @@ Returns the st_dev field of the UNIX C stat structure describing the link */ PHP_FUNCTION(linkinfo) { - zval **filename; + char *link; + int link_len; struct stat sb; int ret; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, filename) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, link, link_len) == FAILURE) { + return; } - convert_to_string_ex(filename); - ret = VCWD_LSTAT(Z_STRVAL_PP(filename), sb); + ret = VCWD_LSTAT(link, sb); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, strerror(errno)); RETURN_LONG(-1L); @@ -111,18 +111,17 @@ Create a symbolic link */ PHP_FUNCTION(symlink) { - zval **topath, **frompath; + char *topath, *frompath; + int topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, topath, frompath) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss, topath, topath_len, frompath,
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c
janiMon Nov 5 17:43:05 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: MFH: Sync [DOC]: note [DOC] -/* {{{ proto bool copy(string source_file, string destination_file) [DOC] +/* {{{ proto bool copy(string source_file, string destination_file [, resource context]) [DOC] [DOC] Apparently this was undocumented so far anyway.. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.1r2=1.409.2.6.2.28.2.2diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.1 php-src/ext/standard/file.c:1.409.2.6.2.28.2.2 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.1 Wed Oct 3 10:44:32 2007 +++ php-src/ext/standard/file.c Mon Nov 5 17:43:04 2007 @@ -19,9 +19,9 @@ | PHP 4.0 patches by Thies C. Arntzen ([EMAIL PROTECTED]) | | PHP streams by Wez Furlong ([EMAIL PROTECTED])| +--+ - */ +*/ -/* $Id: file.c,v 1.409.2.6.2.28.2.1 2007/10/03 10:44:32 dsp Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.2 2007/11/05 17:43:04 jani Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -147,11 +147,10 @@ { return le_stream_context; } - /* }}} */ -/* {{{ Module-Stuff */ - +/* {{{ Module-Stuff +*/ static ZEND_RSRC_DTOR_FUNC(file_context_dtor) { php_stream_context *context = (php_stream_context*)rsrc-ptr; @@ -173,7 +172,6 @@ { } - 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(default_socket_timeout, 60, PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals) @@ -191,7 +189,7 @@ #endif REGISTER_INI_ENTRIES(); - + REGISTER_LONG_CONSTANT(SEEK_SET, SEEK_SET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(SEEK_CUR, SEEK_CUR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(SEEK_END, SEEK_END, CONST_CS | CONST_PERSISTENT); @@ -210,7 +208,7 @@ REGISTER_LONG_CONSTANT(STREAM_NOTIFY_FAILURE, PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_COMPLETED, PHP_STREAM_NOTIFY_COMPLETED,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_RESOLVE, PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); - + REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_INFO, PHP_STREAM_NOTIFY_SEVERITY_INFO,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_WARN, PHP_STREAM_NOTIFY_SEVERITY_WARN,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_NOTIFY_SEVERITY_ERR, PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); @@ -231,7 +229,7 @@ REGISTER_LONG_CONSTANT(STREAM_CRYPTO_METHOD_SSLv3_SERVER, STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_CRYPTO_METHOD_SSLv23_SERVER, STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_CRYPTO_METHOD_TLS_SERVER, STREAM_CRYPTO_METHOD_TLS_SERVER,CONST_CS|CONST_PERSISTENT); - + REGISTER_LONG_CONSTANT(STREAM_SHUT_RD,STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_SHUT_WR,STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_SHUT_RDWR, STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); @@ -285,13 +283,13 @@ REGISTER_LONG_CONSTANT(STREAM_SERVER_BIND, STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_SERVER_LISTEN, STREAM_XPORT_LISTEN,CONST_CS | CONST_PERSISTENT); - + REGISTER_LONG_CONSTANT(FILE_USE_INCLUDE_PATH, PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FILE_IGNORE_NEW_LINES, PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FILE_SKIP_EMPTY_LINES, PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FILE_APPEND, PHP_FILE_APPEND,CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(FILE_NO_DEFAULT_CONTEXT, PHP_FILE_NO_DEFAULT_CONTEXT,CONST_CS | CONST_PERSISTENT); - + #ifdef HAVE_FNMATCH REGISTER_LONG_CONSTANT(FNM_NOESCAPE, FNM_NOESCAPE, CONST_CS |