Re: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard file.c streamsfuncs.c /main php_streams.h /main/streams cast.c streams.c

2009-04-19 Thread Jani Taskinen

Arnaud Le Blanc kirjoitti:

lbarnaudSun Apr 19 13:46:47 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src	NEWS 
/php-src/ext/standard	file.c streamsfuncs.c 
/php-src/main	php_streams.h 
/php-src/main/streams	cast.c streams.c 
  Log:

  Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams)
  


Why didn't you MFH to PHP_5_2 ?!
That's the stable branch still and open for bug fixes like this..

--Jani

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



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard file.c streamsfuncs.c /main php_streams.h /main/streams cast.c streams.c

2009-04-19 Thread Arnaud Le Blanc
lbarnaudSun Apr 19 13:46:47 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/standard   file.c streamsfuncs.c 
/php-src/main   php_streams.h 
/php-src/main/streams   cast.c streams.c 
  Log:
  Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams)
  
  http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.560&r2=1.2027.2.547.2.965.2.561&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.560 
php-src/NEWS:1.2027.2.547.2.965.2.561
--- php-src/NEWS:1.2027.2.547.2.965.2.560   Thu Apr 16 10:16:26 2009
+++ php-src/NEWSSun Apr 19 13:46:46 2009
@@ -12,6 +12,7 @@
   disable this behaviour using "http"=>array("auto_decode"=>0) in stream
   context. (Dmitry)
 
+- Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams). (Arnaud)
 - Fixed bug #47880 (crashes in call_user_func_array()). (Dmitry)
 - Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia)
 - Fixed bug #47851 (is_callable throws fatal error). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.29&r2=1.409.2.6.2.28.2.30&diff_format=u
Index: php-src/ext/standard/file.c
diff -u 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.30
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.29 Tue Jan 20 01:40:05 2009
+++ php-src/ext/standard/file.c Sun Apr 19 13:46:46 2009
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.29 2009/01/20 01:40:05 pajoye Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.30 2009/04/19 13:46:46 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -627,7 +627,10 @@
 
switch (Z_TYPE_P(data)) {
case IS_RESOURCE:
-   numbytes = php_stream_copy_to_stream(srcstream, stream, 
PHP_STREAM_COPY_ALL);
+   numbytes = (int) 
php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL);
+   if ((size_t)numbytes == PHP_STREAM_FAILURE) {
+   numbytes = -1;
+   }
break;
case IS_NULL:
case IS_LONG:
@@ -1783,7 +1786,7 @@
deststream = php_stream_open_wrapper(dest, "wb", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL);
 
if (srcstream && deststream) {
-   ret = php_stream_copy_to_stream(srcstream, deststream, 
PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS;
+   ret = php_stream_copy_to_stream_ex(srcstream, deststream, 
PHP_STREAM_COPY_ALL) == PHP_STREAM_FAILURE ? FAILURE : SUCCESS;
}
if (srcstream) {
php_stream_close(srcstream);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.15.2.34&r2=1.58.2.6.2.15.2.35&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.15.2.34 
php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.15.2.35
--- php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.15.2.34  Fri Jan 23 
15:49:49 2009
+++ php-src/ext/standard/streamsfuncs.c Sun Apr 19 13:46:46 2009
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: streamsfuncs.c,v 1.58.2.6.2.15.2.34 2009/01/23 15:49:49 kalle Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6.2.15.2.35 2009/04/19 13:46:46 lbarnaud Exp $ 
*/
 
 #include "php.h"
 #include "php_globals.h"
@@ -443,6 +443,7 @@
php_stream *src, *dest;
zval *zsrc, *zdest;
long maxlen = PHP_STREAM_COPY_ALL, pos = 0;
+   size_t ret;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, 
&zdest, &maxlen, &pos) == FAILURE) {
RETURN_FALSE;
@@ -456,7 +457,12 @@
RETURN_FALSE;
}
 
-   RETURN_LONG(php_stream_copy_to_stream(src, dest, maxlen));
+   ret = php_stream_copy_to_stream_ex(src, dest, maxlen);
+
+   if (ret == PHP_STREAM_FAILURE) {
+   RETURN_FALSE;
+   }
+   RETURN_LONG(ret);
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.103.2.1.2.4.2.8&r2=1.103.2.1.2.4.2.9&diff_format=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.103.2.1.2.4.2.8 
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.8Wed Dec 31 11:15:47 2008
+++ php-src/main/php_streams.h  Sun Apr 19 13:46:47 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_streams.h,v 1.103.2.1.2.4.2.8 2008/12/31 11:15:47 sebastian Exp $ 
*/
+/* $Id: php_streams.h,v 1.103.2.1.2.4.2.9 2009/04/19 13:46:47 lbarnaud Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -420,9 +420,14 @@
  * Uses mmap if the src is a plain file and at offset 0 */
 #define PHP_ST

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

2008-04-15 Thread Ilia Alshanetsky
iliaa   Tue Apr 15 15:48:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   file.c 
/php-srcNEWS 
  Log:
  MFB: Fixed bug #44034 (FILE_IGNORE_NEW_LINES in file() does not work as
  expected when lines end in \r\n)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.11&r2=1.409.2.6.2.28.2.12&diff_format=u
Index: php-src/ext/standard/file.c
diff -u 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.12
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.11 Sun Mar 30 15:05:48 2008
+++ php-src/ext/standard/file.c Tue Apr 15 15:48:20 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.11 2008/03/30 15:05:48 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.12 2008/04/15 15:48:20 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -775,16 +775,20 @@
} while ((p = memchr(p, eol_marker, (e-p;
} else {
do {
-   if (skip_blank_lines && !(p-s)) {
+   int windows_eol = 0;
+   if (eol_marker == '\n' && *(p - 1) == '\r') {
+   windows_eol++;
+   }
+   if (skip_blank_lines && !(p-s-windows_eol)) {
s = ++p;
continue;
}
if (PG(magic_quotes_runtime)) {
/* s is in target_buf which is freed at 
the end of the function */
-   slashed = php_addslashes(s, (p-s), 
&len, 0 TSRMLS_CC);
+   slashed = php_addslashes(s, 
(p-s-windows_eol), &len, 0 TSRMLS_CC);
add_index_stringl(return_value, i++, 
slashed, len, 0);
} else {
-   add_index_stringl(return_value, i++, 
estrndup(s, p-s), p-s, 0);
+   add_index_stringl(return_value, i++, 
estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
}
s = ++p;
} while ((p = memchr(p, eol_marker, (e-p;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.158&r2=1.2027.2.547.2.965.2.159&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.158 
php-src/NEWS:1.2027.2.547.2.965.2.159
--- php-src/NEWS:1.2027.2.547.2.965.2.158   Mon Apr 14 08:15:11 2008
+++ php-src/NEWSTue Apr 15 15:48:20 2008
@@ -158,6 +158,8 @@
   (Derick, iuri dot fiedoruk at hp dot com).
 - Fixed bug #44214 (Crash using preg_replace_callback() and global variable).
   (Nuno, Scott)
+- Fixed bug #44034 (FILE_IGNORE_NEW_LINES in file() does not work as expected
+  when lines end in \r\n). (Ilia)
 - Fixed bug #43960 (strtotime() returns timestamp in the future when given a
   bogus string). (Derick)
 - Fixed bug #43832 (mysqli_get_charset() doesn't expose charset comment).



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