Re: cvs: php-src /ext/simplexml simplexml.c

From: Date: Sun, 20 Nov 2005 19:33:57 +0000
Subject: Re: cvs: php-src /ext/simplexml simplexml.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-35288@lists.php.net to get a copy of this message
helly Sun Nov 20 08:03:19 2005 EDT Modified files: /php-src/ext/simplexml simplexml.c Log: - Extend SimpleXmlElement::__construct() with two parameters . int options: pass options to 2.6.0+ parsing functions . bool data_is_url: whether first parameter is a url rather then xml data - Fix parameter parsing http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.176&r2=1.177&ty=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.176 php-src/ext/simplexml/simplexml.c:1.177 --- php-src/ext/simplexml/simplexml.c:1.176 Sat Nov 5 17:41:09 2005 +++ php-src/ext/simplexml/simplexml.c Sun Nov 20 08:03:15 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.176 2005/11/05 22:41:09 rasmus Exp $ */ +/* $Id: simplexml.c,v 1.177 2005/11/20 13:03:15 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1576,7 +1576,8 @@
 int             filename_len;
 xmlDocPtr       docp;
 char           *classname = "";
- int             classname_len = 0, options=0;
+ int             classname_len = 0;
+ long            options = 0;
zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, &filename_len, &classname, &classname_len, &options) == FAILURE) { @@ -1619,7 +1620,8 @@
 int             data_len;
 xmlDocPtr       docp;
 char           *classname = "";
- int             classname_len = 0, options=0;
+ int             classname_len = 0;
+ long            options = 0;
zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, &data_len, &classname, &classname_len, &options) == FAILURE) { @@ -1654,7 +1656,7 @@ /* }}} */ -/* {{{ proto SimpleXMLElement::__construct() +/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url]]) SimpleXMLElement constructor */ SXE_METHOD(__construct) { @@ -1662,15 +1664,21 @@
 char           *data;
 int             data_len;
 xmlDocPtr       docp;
+ long            options = 0;
+ zend_bool       is_url = 0;
php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lb", &data, &data_len, &options, &is_url) == FAILURE) { php_std_error_handling(); return; } php_std_error_handling(); - docp = xmlParseMemory(data, data_len); +#if LIBXML_VERSION >= 20600 + docp = is_url ? xmlReadFile(data, NULL, options) : xmlReadMemory(data, data_len, NULL, NULL, options); +#else + docp = is_url ? xmlParseFile(data) : xmlParseMemory(data, data_len); +#endif
The libxml extension only works with version >= 2.6.11 (on both branches), so you can remove that #if. Nuno

« previous php.cvs (#35288) next »