iliaa Sun May 24 16:02:22 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard file.c http_fopen_wrapper.c
/php-src/ext/standard/tests/file fgetcsv_variation14.phpt
fgetcsv_variation21.phpt
Log:
Improve fix for bug #48313
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.42&r2=1.409.2.6.2.43&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.42
php-src/ext/standard/file.c:1.409.2.6.2.43
--- php-src/ext/standard/file.c:1.409.2.6.2.42 Mon May 18 18:46:06 2009
+++ php-src/ext/standard/file.c Sun May 24 16:02:22 2009
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.42 2009/05/18 18:46:06 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.43 2009/05/24 16:02:22 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -2139,6 +2139,7 @@
size_t temp_len, line_end_len;
int inc_len;
+ zend_bool first_field = 1;
/* initialize internal state */
php_mblen(NULL, 0);
@@ -2190,6 +2191,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;
@@ -2384,12 +2390,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/http_fopen_wrapper.c?r1=1.99.2.12.2.17&r2=1.99.2.12.2.18&diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.17
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.18
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.17 Thu May 14
16:15:38 2009
+++ php-src/ext/standard/http_fopen_wrapper.c Sun May 24 16:02:22 2009
@@ -19,7 +19,7 @@
| Sara Golemon <[email protected]> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.17 2009/05/14 16:15:38 lbarnaud Exp
$ */
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.18 2009/05/24 16:02:22 iliaa Exp $
*/
#include "php.h"
#include "php_globals.h"
@@ -553,7 +553,8 @@
response_code = 0;
}
/* when we request only the header, don't fail even on
error codes */
- if (options & STREAM_ONLY_GET_HEADERS) {
+ if ((options & STREAM_ONLY_GET_HEADERS) ||
+ (context &&
php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval) ==
SUCCESS && zend_is_true(*tmpzval)) ) {
reqok = 1;
}
switch(response_code) {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fgetcsv_variation14.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_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.3
--- php-src/ext/standard/tests/file/fgetcsv_variation14.phpt:1.1.2.2 Tue Aug
14 14:07:46 2007
+++ php-src/ext/standard/tests/file/fgetcsv_variation14.phpt Sun May 24
16:02:22 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.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/file/fgetcsv_variation21.phpt
diff -u php-src/ext/standard/tests/file/fgetcsv_variation21.phpt:1.1.2.1
php-src/ext/standard/tests/file/fgetcsv_variation21.phpt:1.1.2.2
--- php-src/ext/standard/tests/file/fgetcsv_variation21.phpt:1.1.2.1 Wed Aug
8 13:13:18 2007
+++ php-src/ext/standard/tests/file/fgetcsv_variation21.phpt Sun May 24
16:02:22 2009
@@ -72,7 +72,7 @@
-- Testing fgetcsv() with file opened using r mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -80,7 +80,7 @@
-- Testing fgetcsv() with file opened using rb mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -88,7 +88,7 @@
-- Testing fgetcsv() with file opened using rt mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -96,7 +96,7 @@
-- Testing fgetcsv() with file opened using r+ mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -104,7 +104,7 @@
-- Testing fgetcsv() with file opened using r+b mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -112,7 +112,7 @@
-- Testing fgetcsv() with file opened using r+t mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -120,7 +120,7 @@
-- Testing fgetcsv() with file opened using a+ mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -128,7 +128,7 @@
-- Testing fgetcsv() with file opened using a+b mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -136,7 +136,7 @@
-- Testing fgetcsv() with file opened using a+t mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -144,7 +144,7 @@
-- Testing fgetcsv() with file opened using w+ mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -152,7 +152,7 @@
-- Testing fgetcsv() with file opened using w+b mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -160,7 +160,7 @@
-- Testing fgetcsv() with file opened using w+t mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -168,7 +168,7 @@
-- Testing fgetcsv() with file opened using x+ mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -176,7 +176,7 @@
-- Testing fgetcsv() with file opened using x+b mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
@@ -184,7 +184,7 @@
-- Testing fgetcsv() with file opened using x+t mode --
array(1) {
[0]=>
- string(0) ""
+ NULL
}
int(1)
bool(false)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php