summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c15
-rwxr-xr-xext/simplexml/sxe.c49
2 files changed, 49 insertions, 15 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 75eb742c0..888a6c0fd 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c 308262 2011-02-11 21:10:48Z felipe $ */
+/* $Id: simplexml.c 314376 2011-08-06 14:47:44Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1264,9 +1264,8 @@ SXE_METHOD(xpath)
result = retval->nodesetval;
- array_init(return_value);
-
if (result != NULL) {
+ array_init(return_value);
for (i = 0; i < result->nodeNr; ++i) {
nodeptr = result->nodeTab[i];
if (nodeptr->type == XML_TEXT_NODE || nodeptr->type == XML_ELEMENT_NODE || nodeptr->type == XML_ATTRIBUTE_NODE) {
@@ -1287,6 +1286,8 @@ SXE_METHOD(xpath)
add_next_index_zval(return_value, value);
}
}
+ } else {
+ RETVAL_FALSE;
}
xmlXPathFreeObject(retval);
@@ -2515,14 +2516,14 @@ const zend_function_entry simplexml_functions[] = { /* {{{ */
PHP_FE(simplexml_load_file, arginfo_simplexml_load_file)
PHP_FE(simplexml_load_string, arginfo_simplexml_load_string)
PHP_FE(simplexml_import_dom, arginfo_simplexml_import_dom)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
static const zend_module_dep simplexml_deps[] = { /* {{{ */
ZEND_MOD_REQUIRED("libxml")
ZEND_MOD_REQUIRED("spl")
- {NULL, NULL, NULL}
+ ZEND_MOD_END
};
/* }}} */
@@ -2562,7 +2563,7 @@ static const zend_function_entry sxe_functions[] = { /* {{{ */
SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
SXE_ME(__toString, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
SXE_ME(count, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
@@ -2608,7 +2609,7 @@ PHP_MINFO_FUNCTION(simplexml)
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 308262 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 314376 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index 8bc5bcb33..815bea1db 100755
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sxe.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: sxe.c 312258 2011-06-18 15:56:14Z felipe $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -41,6 +41,10 @@ zend_class_entry *ce_SimpleXMLElement;
PHP_METHOD(ce_SimpleXMLIterator, rewind)
{
php_sxe_iterator iter;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter TSRMLS_CC);
@@ -52,6 +56,10 @@ PHP_METHOD(ce_SimpleXMLIterator, rewind)
PHP_METHOD(ce_SimpleXMLIterator, valid)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(sxe->iter.data);
}
@@ -62,6 +70,10 @@ PHP_METHOD(ce_SimpleXMLIterator, valid)
PHP_METHOD(ce_SimpleXMLIterator, current)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (!sxe->iter.data) {
return; /* return NULL */
@@ -78,6 +90,10 @@ PHP_METHOD(ce_SimpleXMLIterator, key)
xmlNodePtr curnode;
php_sxe_object *intern;
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (!sxe->iter.data) {
RETURN_FALSE;
@@ -98,6 +114,10 @@ PHP_METHOD(ce_SimpleXMLIterator, key)
PHP_METHOD(ce_SimpleXMLIterator, next)
{
php_sxe_iterator iter;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter TSRMLS_CC);
@@ -111,6 +131,10 @@ PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
php_sxe_object *child;
xmlNodePtr node;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
RETURN_FALSE;
@@ -133,6 +157,10 @@ PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
PHP_METHOD(ce_SimpleXMLIterator, getChildren)
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
return; /* return NULL */
@@ -140,14 +168,19 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
RETURN_ZVAL(sxe->iter.data, 1, 0);
}
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO(arginfo_simplexmliterator__void, 0)
+ZEND_END_ARG_INFO()
+/* }}} */
+
static const zend_function_entry funcs_SimpleXMLIterator[] = {
- PHP_ME(ce_SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, current, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, key, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, valid, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, current, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, key, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, next, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
/* }}} */