[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2005-03-02 Thread Ilia Alshanetsky
iliaa   Wed Mar  2 22:32:00 2005 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #32160 (file truncation in copy() when source  destination are
  the same).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.848r2=1.1247.2.849ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.848 php-src/NEWS:1.1247.2.849
--- php-src/NEWS:1.1247.2.848   Tue Mar  1 16:34:29 2005
+++ php-src/NEWSWed Mar  2 22:31:57 2005
@@ -17,6 +17,8 @@
 - Fixed several leaks in ext/filepro. (Tony)
 - Fixed build system to always use bundled libtool files. (Jani)  
 - Fixed MacOSX shared extensions crashing on Apache startup. (Rasmus)
+- Fixed bug #32160 (file truncation in copy() when source  destination are
+  the same). (Ilia)
 - Fixed bug #31960 (msql_fetch_row() and msql_fetch_array() dropping columns
   with NULL values). (Daniel Convissor)
 - Fixed bug #31936 (set_h_errno() is redefined incompatibly). (Jani)
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.68r2=1.279.2.69ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.68 
php-src/ext/standard/file.c:1.279.2.69
--- php-src/ext/standard/file.c:1.279.2.68  Mon Jan 17 19:14:56 2005
+++ php-src/ext/standard/file.c Wed Mar  2 22:31:59 2005
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.68 2005/01/18 00:14:56 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.69 2005/03/03 03:31:59 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2141,6 +2141,12 @@
 {
php_stream *srcstream = NULL, *deststream = NULL;
int ret = FAILURE;
+   struct stat src_s, dest_s;
+
+   /* safety check to ensure that source  destination files are not the 
same file */
+   if (stat(src, src_s) || (stat(dest, dest_s) == 0  src_s.st_ino == 
dest_s.st_ino)) {
+   return ret;
+   }
 
srcstream = php_stream_open_wrapper(src, rb,
STREAM_DISABLE_OPEN_BASEDIR | REPORT_ERRORS,

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2005-01-17 Thread Ilia Alshanetsky
iliaa   Mon Jan 17 19:14:56 2005 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  Fixed bug #31580 (fgetcsv() problematic with  escape sequences).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.803r2=1.1247.2.804ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.803 php-src/NEWS:1.1247.2.804
--- php-src/NEWS:1.1247.2.803   Mon Jan 17 12:22:21 2005
+++ php-src/NEWSMon Jan 17 19:14:55 2005
@@ -3,6 +3,7 @@
 ?? ??? , Version 4.3.11
 - Fixed MacOSX shared extensions crashing on Apache startup. (Rasmus)
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
+- Fixed bug #31580 (fgetcsv() problematic with  escape sequences). (Ilia)
 - Fixed bug #31454 (session_set_save_handler crashes PHP when supplied
   non-existent object ref). (Tony)
 - Fixed bug #31444 (Memory leak in zend_language_scanner.c).
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.67r2=1.279.2.68ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.67 
php-src/ext/standard/file.c:1.279.2.68
--- php-src/ext/standard/file.c:1.279.2.67  Wed Dec  8 16:15:02 2004
+++ php-src/ext/standard/file.c Mon Jan 17 19:14:56 2005
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.67 2004/12/08 21:15:02 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.68 2005/01/18 00:14:56 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2427,9 +2427,6 @@
if ((p = memchr(p2, delimiter, (e - p2 {
p2 = s;
s = p + 1;
-   if (*p2 == enclosure) {
-   p2++;
-   }
 
/* copy data to buffer */
buf2 = erealloc(buf2, buf2_len + (p - p2) + 1);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2004-12-08 Thread Ilia Alshanetsky
iliaa   Wed Dec  8 16:15:03 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #31024 (Crash in fgetcsv() with negative length).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.767r2=1.1247.2.768ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.767 php-src/NEWS:1.1247.2.768
--- php-src/NEWS:1.1247.2.767   Tue Dec  7 20:09:53 2004
+++ php-src/NEWSWed Dec  8 16:15:01 2004
@@ -1,5 +1,9 @@
 PHP 4  NEWS
 |||
+?? Dec 2004, Version 4.3.10
+- Fixed bug #31024 (Crash in fgetcsv() with negative length). (Ilia)
+- Fixed bug #31019 (Logic error mssql library checking). (Frank)
+
 07 Dec 2004, Version 4.3.10RC2
 - Fixed bug #30995 (snmp extension does not build with net-snmp 5.2). (Ilia)
 - Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). (Ilia)
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.66r2=1.279.2.67ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.66 
php-src/ext/standard/file.c:1.279.2.67
--- php-src/ext/standard/file.c:1.279.2.66  Mon Dec  6 18:31:58 2004
+++ php-src/ext/standard/file.c Wed Dec  8 16:15:02 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.66 2004/12/06 23:31:58 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.67 2004/12/08 21:15:02 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2335,7 +2335,7 @@
 
convert_to_long_ex(bytes);
len = Z_LVAL_PP(bytes);
-   if (len  0) {
+   if (Z_LVAL_PP(bytes)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter 
may not be negative);
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_4_3) / NEWS /ext/standard file.c

2004-12-06 Thread Ilia Alshanetsky
iliaa   Mon Dec  6 18:31:58 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.761r2=1.1247.2.762ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.761 php-src/NEWS:1.1247.2.762
--- php-src/NEWS:1.1247.2.761   Mon Dec  6 14:44:32 2004
+++ php-src/NEWSMon Dec  6 18:31:57 2004
@@ -1,6 +1,7 @@
 PHP 4  NEWS
 |||
 ?? Nov 2004, Version 4.3.10
+- Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag).
 
 23 Nov 2004, Version 4.3.10RC1
 - Added the %F modifier to *printf to render a non-locale-aware representation
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.65r2=1.279.2.66ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.65 
php-src/ext/standard/file.c:1.279.2.66
--- php-src/ext/standard/file.c:1.279.2.65  Thu Oct 28 20:38:44 2004
+++ php-src/ext/standard/file.c Mon Dec  6 18:31:58 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.65 2004/10/29 00:38:44 andi Exp $ */
+/* $Id: file.c,v 1.279.2.66 2004/12/06 23:31:58 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1198,6 +1198,14 @@
convert_to_string_ex(arg1);
convert_to_string_ex(arg2);
p = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
+#ifndef PHP_WIN32
+   {
+   char *z = memchr(p, 'b', Z_STRLEN_PP(arg2));
+   if (z) {
+   memmove(p + (z - p), z + 1, Z_STRLEN_PP(arg2) - (z - 
p));
+   }
+   }
+#endif
if (PG(safe_mode)){
b = strchr(Z_STRVAL_PP(arg1), ' ');
if (!b) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2004-08-17 Thread Ilia Alshanetsky
iliaa   Tue Aug 17 10:10:04 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  Fixed bug #29719 (fgetcsv() has problem parsing strings ending with escaped
  enclosures).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.717r2=1.1247.2.718ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.717 php-src/NEWS:1.1247.2.718
--- php-src/NEWS:1.1247.2.717   Mon Aug 16 19:08:53 2004
+++ php-src/NEWSTue Aug 17 10:10:03 2004
@@ -2,6 +2,8 @@
 |||
 ?? ??? 2004, Version 4.3.9
 - Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev)
+- Fixed bug #29719 (fgetcsv() has problem parsing strings ending with escaped
+  enclosures). (Ilia)
 - Fixed bug #29599 (domxml_error segfaults another apache module). (Rob)
 - Fixed bug #29594 (Use PHP's own tmpfile() implementation). (Ilia)
 
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.60r2=1.279.2.61ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.60 php-src/ext/standard/file.c:1.279.2.61
--- php-src/ext/standard/file.c:1.279.2.60  Fri May 14 12:12:06 2004
+++ php-src/ext/standard/file.c Tue Aug 17 10:10:03 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.60 2004/05/14 16:12:06 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.61 2004/08/17 14:10:03 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2410,10 +2410,6 @@
goto enclosure;
}
} else {
-   while (e  re  e  s  *(e - 1) == enclosure) {
-   e--;
-   }
-
buf2 = erealloc(buf2, buf2_len + (e - s) + 1);
memcpy(buf2 + buf2_len, s, (e - s));
buf2_len += e - s;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2004-01-20 Thread Ilia Alshanetsky
iliaa   Tue Jan 20 21:33:23 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #26974 (rename() doesn't check the destination file against
  safe_mode/open_basedir).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.535r2=1.1247.2.536ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.535 php-src/NEWS:1.1247.2.536
--- php-src/NEWS:1.1247.2.535   Mon Jan 19 20:11:39 2004
+++ php-src/NEWSTue Jan 20 21:33:21 2004
@@ -1,6 +1,8 @@
 PHP 4  NEWS
 |||
 ?? Jan 2004, Version 4.3.5
+- Fixed bug #26974 (rename() doesn't check the destination file against 
+  safe_mode/open_basedir). (Ilia)
 - Fixed bug #26969 (--with-openssl=shared build fails). (Jani)
 - Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled). (Jani)
 - Fixed bug #26937 (Warning in xml.c). (Jani)
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.279.2.55r2=1.279.2.56ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.55 php-src/ext/standard/file.c:1.279.2.56
--- php-src/ext/standard/file.c:1.279.2.55  Mon Jan 19 13:40:45 2004
+++ php-src/ext/standard/file.c Tue Jan 20 21:33:22 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.55 2004/01/19 18:40:45 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.56 2004/01/21 02:33:22 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1899,11 +1899,12 @@
old_name = Z_STRVAL_PP(old_arg);
new_name = Z_STRVAL_PP(new_arg);
 
-   if (PG(safe_mode) (!php_checkuid(old_name, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+   if (PG(safe_mode)  (!php_checkuid(old_name, NULL, 
CHECKUID_CHECK_FILE_AND_DIR) ||
+   !php_checkuid(new_name, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
 
-   if (php_check_open_basedir(old_name TSRMLS_CC)) {
+   if (php_check_open_basedir(old_name TSRMLS_CC) || 
php_check_open_basedir(new_name TSRMLS_CC)) {
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_4_3) / NEWS /ext/standard file.c

2004-01-14 Thread Wez Furlong
wez Wed Jan 14 09:31:28 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  Fixed bug #26772 (fgets returns NULL instead of FALSE). (Wez)
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.524 php-src/NEWS:1.1247.2.525
--- php-src/NEWS:1.1247.2.524   Tue Jan 13 18:31:44 2004
+++ php-src/NEWSWed Jan 14 09:31:25 2004
@@ -4,6 +4,7 @@
 - Fixed bug #26878 (problem with multiple references to the same variable 
   with different types). (Ilia)
 - Fixed bug #26896 (ext/ftp does not work as shared extension). (Jani)
+- Fixed bug #26772 (fgets returns NULL instead of FALSE). (Wez)
 
 12 Jan 2004, Version 4.3.5RC1
 - Synchronized bundled GD library with GD 2.0.17
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.52 php-src/ext/standard/file.c:1.279.2.53
--- php-src/ext/standard/file.c:1.279.2.52  Fri Jan  2 19:50:01 2004
+++ php-src/ext/standard/file.c Wed Jan 14 09:31:27 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.52 2004/01/03 00:50:01 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.53 2004/01/14 14:31:27 wez Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1363,7 +1363,11 @@
WRONG_PARAM_COUNT;
}
 
-   php_stream_from_zval(stream, arg1);
+   php_stream_from_zval_no_verify(stream, arg1);
+   if (stream == NULL) {
+   /* want a false return value here */
+   goto exit_failed;
+   }
 
if (argc == 1) {
/* ask streams to give us a buffer of an appropriate size */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2004-01-01 Thread Ilia Alshanetsky
iliaa   Thu Jan  1 19:58:16 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #26752 (Silent unterminated loop when length parameter for
  fgets(), fread() and fgetss() is 0).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.514 php-src/NEWS:1.1247.2.515
--- php-src/NEWS:1.1247.2.514   Wed Dec 31 06:28:39 2003
+++ php-src/NEWSThu Jan  1 19:58:14 2004
@@ -10,6 +10,8 @@
 - Added a warning when creating temp stream fails with ftp_(n)list(). (Sara)
 - Fixed header handler in NSAPI SAPI module (header-replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26752 (Silent unterminated loop when length parameter for
+  fgets(), fread() and fgetss() is 0). (Ilia)
 - Fixed bug #26751 (PHP can't find the MySQL socket on a case sensitive file
   system). (Derick)
 - Fixed Bug #26703 (Certain characters inside strings incorrectly treated as
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.50 php-src/ext/standard/file.c:1.279.2.51
--- php-src/ext/standard/file.c:1.279.2.50  Sun Dec 28 14:31:48 2003
+++ php-src/ext/standard/file.c Thu Jan  1 19:58:15 2004
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.50 2003/12/28 19:31:48 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.51 2004/01/02 00:58:15 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1374,8 +1374,8 @@
convert_to_long_ex(arg2);
len = Z_LVAL_PP(arg2);
 
-   if (len  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter 
may not be negative);
+   if (len = 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter 
must be greater then 0.);
RETURN_FALSE;
}
 
@@ -1471,8 +1471,8 @@
 
convert_to_long_ex(bytes);
len = Z_LVAL_PP(bytes);
-   if (len  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter may not 
be negative);
+   if (len = 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter must be 
greater then 0.);
RETURN_FALSE;
}
 
@@ -2136,8 +2136,8 @@
 
convert_to_long_ex(arg2);
len = Z_LVAL_PP(arg2);
-   if (len  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter may not 
be negative);
+   if (len = 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Length parameter must be 
greater then 0.);
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_4_3) / NEWS /ext/standard file.c

2003-11-23 Thread Ilia Alshanetsky
iliaa   Sun Nov 23 20:44:00 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #26355 (flock() doesn't initialize the wouldblock argument)
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.475 php-src/NEWS:1.1247.2.476
--- php-src/NEWS:1.1247.2.475   Sat Nov 22 08:40:39 2003
+++ php-src/NEWSSun Nov 23 20:43:58 2003
@@ -3,6 +3,7 @@
 ?? ??? 2003, Version 4.3.5
 - Fixed header handler in NSAPI SAPI module (header-replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26355 (flock() doesn't initialize the wouldblock argument). (Ilia)
 - Fixed bug #26309 (Fixed argument parsing for imageftbbox()). (Ilia)
 - Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows). (Ilia)
 - Fixed bug #26267 (gmp_random() leaks memory and does not produce random
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.39 php-src/ext/standard/file.c:1.279.2.40
--- php-src/ext/standard/file.c:1.279.2.39  Fri Nov  7 16:40:46 2003
+++ php-src/ext/standard/file.c Sun Nov 23 20:43:59 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.39 2003/11/07 21:40:46 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.40 2003/11/24 01:43:59 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -247,12 +247,17 @@
RETURN_FALSE;
}
 
+   if (arg_count == 3) {
+   convert_to_long_ex(arg3);
+   Z_LVAL_PP(arg3) = 0;
+   }
+
/* flock_values contains all possible actions
   if (arg2  4) we won't block on the lock */
act = flock_values[act - 1] | (Z_LVAL_PP(arg2)  4 ? LOCK_NB : 0);
if (flock(fd, act)) {
if (errno == EWOULDBLOCK  arg_count == 3) {
-   ZVAL_LONG(*arg3, 1);
+   Z_LVAL_PP(arg3) = 1;
} 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_4_3) / NEWS /ext/standard file.c /ext/standard/tests/file bug26003.phpt test3.csv

2003-11-07 Thread Ilia Alshanetsky
iliaa   Fri Nov  7 16:40:48 2003 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/standard/tests/filetest3.csv bug26003.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  Fixed bug #26003 (Make fgetcsv() binary safe). (Ilia)
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.460 php-src/NEWS:1.1247.2.461
--- php-src/NEWS:1.1247.2.460   Thu Nov  6 15:34:57 2003
+++ php-src/NEWSFri Nov  7 16:40:45 2003
@@ -17,6 +17,7 @@
   after every mcrypt_generic_init() call). (Ilia)
 - Fixed bug #26025 (Segfault on glob() without GLOB_NOCHECK or GLOB_NOMAGIC
   under *BSD platforms). (Moriyoshi)
+- Fixed bug #26003 (Make fgetcsv() binary safe). (Ilia)
 - Fixed bug #25581 (getimagesize () return incorrect values on bitmap
   (os2) files). (Marcus)
 
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.38 php-src/ext/standard/file.c:1.279.2.39
--- php-src/ext/standard/file.c:1.279.2.38  Thu Oct  9 21:38:01 2003
+++ php-src/ext/standard/file.c Fri Nov  7 16:40:46 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.38 2003/10/10 01:38:01 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.39 2003/11/07 21:40:46 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2161,7 +2161,7 @@
/* first section exactly as php_fgetss */
 
zval **fd, **bytes, **p_delim, **p_enclosure;
-   int len, temp_len;
+   int len, temp_len, buf_len;
char *buf;
php_stream *stream;
 
@@ -2225,7 +2225,7 @@
/* needed because recv/read/gzread doesnt set null char at end */
memset(buf, 0, len + 1);
 
-   if (php_stream_gets(stream, buf, len) == NULL) {
+   if (php_stream_get_line(stream, buf, len, buf_len) == NULL) {
efree(buf);
RETURN_FALSE;
}
@@ -2236,7 +2236,7 @@
 
lineEnd = emalloc(len + 1);
bptr = buf;
-   tptr = buf + strlen(buf) -1;
+   tptr = buf + buf_len -1;
while ( isspace((int)*(unsigned char *)tptr)  (*tptr!=delimiter)  (tptr  
bptr) ) tptr--;
tptr++;
strcpy(lineEnd, tptr);
@@ -2299,17 +2299,25 @@
*tptr++ = *bptr++;
 
if (*bptr == 0) {   /* embedded line end? 
*/
+   if ((bptr - buf)  buf_len) {
+   while (*bptr == '\0') {
+   *tptr++ = *bptr++;
+   }
+   continue;
+   }
+   
*(tptr-1)=0;/* remove 
space character added on reading line */
strcat(temp, lineEnd);   /* add the 
embedded line end to the field */
 
/* read a new line from input, as at 
start of routine */
memset(buf, 0, len+1);
 
-   if (php_stream_gets(stream, buf, len) 
== NULL) {
+   if (php_stream_get_line(stream, buf, 
len, buf_len) == NULL) {
/* we've got an unterminated 
enclosure, assign all the data
 * from the start of the 
enclosure to end of data to the last element
 */
if (temp_len  len) { 
+   *tptr = 0;
break;
}

@@ -2323,7 +2331,7 @@
temp_len += len;
temp = erealloc(temp, temp_len+1);
bptr = buf;
-   tptr = buf + strlen(buf) -1;
+   tptr = buf + buf_len -1;
while (isspace((int)*(unsigned char 
*)tptr)  (*tptr!=delimiter)  (tptr  bptr)) 
tptr--;
tptr++; 
@@ -2339,14 +2347,17 @@
}
} else {
/* 2B. Handle non-enclosure field */
-   while ((*bptr != delimiter)  *bptr) 
+  

[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2003-10-09 Thread Ilia Alshanetsky
iliaa   Thu Oct  9 21:38:04 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/standard   file.c 
/php-srcNEWS 
  Log:
  Fixed bug #25814 (Make flock() return correct value when 3rd argument is
  used).
  
  # This bug is 4.3.X specific, no need to MFB into 5.X tree.
  
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.37 php-src/ext/standard/file.c:1.279.2.38
--- php-src/ext/standard/file.c:1.279.2.37  Mon Sep 29 10:04:16 2003
+++ php-src/ext/standard/file.c Thu Oct  9 21:38:01 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.37 2003/09/29 14:04:16 stas Exp $ */
+/* $Id: file.c,v 1.279.2.38 2003/10/10 01:38:01 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -226,7 +226,7 @@
 PHP_FUNCTION(flock)
 {
zval **arg1, **arg2, **arg3;
-   int fd, act, ret, arg_count = ZEND_NUM_ARGS();
+   int fd, act, arg_count = ZEND_NUM_ARGS();
php_stream *stream;
 
if (arg_count  2 || arg_count  3 || zend_get_parameters_ex(arg_count, arg1, 
arg2, arg3) == FAILURE) {
@@ -250,11 +250,12 @@
/* flock_values contains all possible actions
   if (arg2  4) we won't block on the lock */
act = flock_values[act - 1] | (Z_LVAL_PP(arg2)  4 ? LOCK_NB : 0);
-   if ((ret=flock(fd, act)) == -1) {
-   RETURN_FALSE;
-   }
-   if(ret == -1  errno == EWOULDBLOCK  arg_count == 3) {
-   ZVAL_LONG(*arg3, 1);
+   if (flock(fd, act)) {
+   if (errno == EWOULDBLOCK  arg_count == 3) {
+   ZVAL_LONG(*arg3, 1);
+   } else {
+   RETURN_FALSE;
+   }   
}
RETURN_TRUE;
 }
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.432 php-src/NEWS:1.1247.2.433
--- php-src/NEWS:1.1247.2.432   Wed Oct  8 22:59:02 2003
+++ php-src/NEWSThu Oct  9 21:38:02 2003
@@ -3,6 +3,8 @@
 ?? Oct 2003, Version 4.3.4RC2
 - Fixed multibyte regex engine to properly handle .* pattern under
   POSIX compatible mode. (K.Kosako kosako at sofnec.co.jp, Moriyoshi)
+- Fixed bug #25814 (Make flock() return correct value when 3rd argument is
+  used). (Ilia)
 - Fixed bug #25780 (ext/session: invalid session.cookie_lifetime makes 
   session_start() to crash in win32). (Jani)
 - Fixed bug #25770 (Segfault with PHP and bison 1.875). ([EMAIL PROTECTED], Marcus)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2003-09-09 Thread Ilia Alshanetsky
iliaa   Tue Sep  9 20:22:21 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/standard   file.c 
/php-srcNEWS 
  Log:
  MFH: Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent
  paths)
  
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.34 php-src/ext/standard/file.c:1.279.2.35
--- php-src/ext/standard/file.c:1.279.2.34  Tue Jul 29 14:26:59 2003
+++ php-src/ext/standard/file.c Tue Sep  9 20:22:19 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.34 2003/07/29 18:26:59 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.35 2003/09/10 00:22:19 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -43,6 +43,7 @@
 #include sys/stat.h
 #include fcntl.h
 #ifdef PHP_WIN32
+#include io.h
 #include windows.h
 #include winsock.h
 #define O_RDONLY _O_RDONLY
@@ -2378,6 +2379,15 @@
convert_to_string_ex(path);
 
if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
+#if ZTS
+# if PHP_WIN32
+   if (_access(resolved_path_buff, 0))
+   RETURN_FALSE;
+# else
+   if (access(resolved_path_buff, F_OK))
+   RETURN_FALSE;
+# endif
+#endif
RETURN_STRING(resolved_path_buff, 1);
} else {
RETURN_FALSE;
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.382 php-src/NEWS:1.1247.2.383
--- php-src/NEWS:1.1247.2.382   Tue Sep  9 17:47:20 2003
+++ php-src/NEWSTue Sep  9 20:22:20 2003
@@ -28,6 +28,8 @@
 - Fixed bug #23326 (ext/domxml: Attributes via append_child not supported).
   (Melvyn)
 - Fixed bug #21220 (Wrong Apache version shown in phpinfo() output). (Jani)
+- Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent
+  paths). (Ilia)
 
 25 Aug 2003, Version 4.3.3
 - Upgraded the bundled Expat library to version 1.95.6. (Jani)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard file.c

2003-07-27 Thread Ilia Alshanetsky
iliaa   Sun Jul 27 14:46:03 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #24557 (make fclose() respect refcount on the resource).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.306 php-src/NEWS:1.1247.2.307
--- php-src/NEWS:1.1247.2.306   Sun Jul 27 14:16:47 2003
+++ php-src/NEWSSun Jul 27 14:46:03 2003
@@ -34,6 +34,8 @@
 - Fixed bug #24573 (debug_backtrace() crashes if $this set to null). (Jani)
 - Fixed bug #24560 (parse_url() incorrectly handling certain file:// based 
   schemas). (Ilia)
+- Fixed bug #24557 (make fclose() respect refcount on the resource). 
+  (Wez, Ilia)
 - Fixed bug #24537 (apache2 compile misses some include directories). (Jani)
 - Fixed bug #24535 (ext/mysql: crash when retrieving data from unbuffered
   result after the original connection has been changed). (Ilia)
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.31 php-src/ext/standard/file.c:1.279.2.32
--- php-src/ext/standard/file.c:1.279.2.31  Thu Jul 24 11:23:14 2003
+++ php-src/ext/standard/file.c Sun Jul 27 14:46:03 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.31 2003/07/24 15:23:14 wez Exp $ */
+/* $Id: file.c,v 1.279.2.32 2003/07/27 18:46:03 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1156,7 +1156,7 @@
}
 
php_stream_from_zval(stream, arg1);
-   php_stream_close(stream);
+   zend_list_delete(stream-rsrc_id);
 
RETURN_TRUE;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php