TechSpider
A searchable, categorised online resourse for finding technical information and solutions to problems
Welcome! You are viewing the programming category.
Below are the PHP and cvs: php-src(PHP_5_3) /ext/xmlwriter php_xmlwriter.c /ext/xmlwriter/tests xmlwriter_open_uri_error_003.phpt xmlwriter_open_uri_error_004.phpt xmlwriter_open_uri_error_005.phpt related pages
Custom Search
You can search the database for more PHP articles using the box below:
Custom Search

PHP Articles:
pajoye Mon May 25 15:35:03 2009 UTC

Modified files: (Branch: PHP_5_3)
/php-src/ext/xmlwriter php_xmlwriter.c
/php-src/ext/xmlwriter/tests xmlwriter_open_uri_error_003.phpt
xmlwriter_open_uri_error_004.phpt
xmlwriter_open_uri_error_005.phpt
Log:
- #48202, Out of memory error when passing non-existing filename, enable related tests (marked as XFAIL now)

Index: php-src/ext/xmlwriter/php_xmlwriter.c
diff -u php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12.2.15.2.12 php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12.2.15.2.13
+++ php-src/ext/xmlwriter/php_xmlwriter.c Mon May 25 15:35:03 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: php_xmlwriter.c,v 1.20.2.12.2.15.2.12 2009/05/11 12:21:26 iliaa Exp $ */
+/* $Id: php_xmlwriter.c,v 1.20.2.12.2.15.2.13 2009/05/25 15:35:03 pajoye Exp $ */

#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,7 +28,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_xmlwriter.h"
-
+#include "ext/standard/php_string.h"

#if LIBXML_VERSION >= 20605
static PHP_FUNCTION(xmlwriter_set_indent);
@@ -614,7 +614,10 @@

if (uri->scheme != NULL) {
/* absolute file uris - libxml only supports localhost or empty host */
- if (strncasecmp(source, "file:///",8) == 0) {
+ if (strncasecmp(source, "file:///", 8) == 0) {
+ if (strlen(source) == 8) {
+ return NULL;
+ }
isFileUri = 1;
#ifdef PHP_WIN32
source += 8;
@@ -622,6 +625,10 @@
source += 7;
#endif
} else if (strncasecmp(source, "file://localhost/",17) == 0) {
+ if (strlen(source) == 17) {
+ return NULL;
+ }
+
isFileUri = 1;
#ifdef PHP_WIN32
source += 17;
@@ -631,13 +638,26 @@
}
}

- file_dest = source;
-
if ((uri->scheme == NULL || isFileUri)) {
+ char file_dirname[MAXPATHLEN];
+ size_t dir_len;
+
if (!VCWD_REALPATH(source, resolved_path) && !expand_filepath(source, resolved_path TSRMLS_CC)) {
xmlFreeURI(uri);
return NULL;
}
+
+ memcpy(file_dirname, source, strlen(source));
+ dir_len = php_dirname(file_dirname, strlen(source));
+
+ if (dir_len > 0) {
+ struct stat buf;
+ if (php_sys_stat(file_dirname, &buf) != 0) {
+ xmlFreeURI(uri);
+ return NULL;
+ }
+ }
+
file_dest = resolved_path;
}

Index: php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_003.phpt
diff -u php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_003.phpt:1.1.2.2 php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_003.phpt:1.1.2.3
+++ php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_003.phpt Mon May 25 15:35:03 2009
@@ -10,9 +10,7 @@
Theo van der Zee
#Test Fest Utrecht 09-05-2009
-Getting error: xmlNewTextWriterFilename : out of memory!
--EXPECTF--

-Warning: xmlwriter_open_uri(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: xmlwriter_open_uri(): Unable to resolve file path in %s on line %d
bool(false)
Index: php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_004.phpt
diff -u php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_004.phpt:1.1.2.2 php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_004.phpt:1.1.2.3
+++ php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_004.phpt Mon May 25 15:35:03 2009
@@ -10,9 +10,7 @@
Theo van der Zee
#Test Fest Utrecht 09-05-2009
-Getting error: xmlNewTextWriterFilename : out of memory!
--EXPECTF--

-Warning: xmlwriter_open_uri(/): failed to open stream: Is a directory in %s on line %d
+Warning: xmlwriter_open_uri(): Unable to resolve file path in %s on line %d
bool(false)
Index: php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_005.phpt
diff -u php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_005.phpt:1.1.2.2 php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_005.phpt:1.1.2.3
+++ php-src/ext/xmlwriter/tests/xmlwriter_open_uri_error_005.phpt Mon May 25 15:35:03 2009
@@ -10,9 +10,7 @@
Theo van der Zee
#Test Fest Utrecht 09-05-2009
-Getting error: xmlNewTextWriterFilename : out of memory!
--EXPECTF--

-Warning: xmlwriter_open_uri(/): failed to open stream: Is a directory in %s on line %d
+Warning: xmlwriter_open_uri(): Unable to resolve file path in %s on line %d
bool(false)







Article list Name Date
Currently Viewing : This ArticlePierre-Alain Joye2009-05-25 15:35:03


Copyright Techspider V0.81   |   Techspider Sitemap