- PGSQL / PDO PGSQL:
. The PGSQL and PDO PGSQL extensions now require at least libpq 9.1.
+- SimpleXML:
+ . SimpleXMLElement now implements RecursiveIterator and absorbed the
+ functionality of SimpleXMLIterator. SimpleXMLIterator is an empty extension
+ of SimpleXMLElement.
+
- Shmop:
. shmop_open() will now return a Shmop object rather than a resource. Return
value checks using is_resource() should be replaced with checks for `false`.
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: a2e7d50e79d253e7136a54222346341003cc3b04 */
+ * Stub hash: e451ccfbe66fc2b6fc0dae6e7e5710ededaf7b0c */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_shmop_open, 0, 4, Shmop, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
PHP_SETUP_LIBXML(SIMPLEXML_SHARED_LIBADD, [
AC_DEFINE(HAVE_SIMPLEXML,1,[ ])
- PHP_NEW_EXTENSION(simplexml, simplexml.c sxe.c, $ext_shared)
+ PHP_NEW_EXTENSION(simplexml, simplexml.c, $ext_shared)
PHP_INSTALL_HEADERS([ext/simplexml/php_simplexml.h ext/simplexml/php_simplexml_exports.h])
PHP_SUBST(SIMPLEXML_SHARED_LIBADD)
])
ADD_EXTENSION_DEP('simplexml', 'libxml') &&
CHECK_HEADER_ADD_INCLUDE("libxml/tree.h", "CFLAGS_SIMPLEXML", PHP_PHP_BUILD + "\\include\\libxml2")
) {
- EXTENSION("simplexml", "simplexml.c sxe.c");
+ EXTENSION("simplexml", "simplexml.c");
AC_DEFINE("HAVE_SIMPLEXML", 1, "Simple XML support");
if (!PHP_SIMPLEXML_SHARED) {
ADD_FLAG("CFLAGS_SIMPLEXML", "/D LIBXML_STATIC");
# define PHP_SXE_API ZEND_API
#endif
+extern PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator;
+extern PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
+
PHP_SXE_API zend_class_entry *sxe_get_element_class_entry(void);
#endif
#include "simplexml_arginfo.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
-#include "sxe.h"
+#include "ext/spl/spl_iterators.h"
zend_class_entry *sxe_class_entry = NULL;
+PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator;
+PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
PHP_SXE_API zend_class_entry *sxe_get_element_class_entry(void) /* {{{ */
{
}
/* }}} */
+
+/* {{{ proto void SimpleXMLElement::rewind()
+ Rewind to first element */
+SXE_METHOD(rewind)
+{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ php_sxe_rewind_iterator(Z_SXEOBJ_P(ZEND_THIS));
+}
+/* }}} */
+
+/* {{{ proto bool SimpleXMLElement::valid()
+ Check whether iteration is valid */
+SXE_METHOD(valid)
+{
+ php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ RETURN_BOOL(!Z_ISUNDEF(sxe->iter.data));
+}
+/* }}} */
+
+/* {{{ proto SimpleXMLElement SimpleXMLElement::current()
+ Get current element */
+SXE_METHOD(current)
+{
+ php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
+ zval *data;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (Z_ISUNDEF(sxe->iter.data)) {
+ return; /* return NULL */
+ }
+
+ data = &sxe->iter.data;
+ ZVAL_COPY_DEREF(return_value, data);
+}
+/* }}} */
+
+/* {{{ proto string SimpleXMLElement::key()
+ Get name of current child element */
+SXE_METHOD(key)
+{
+ xmlNodePtr curnode;
+ php_sxe_object *intern;
+ php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (Z_ISUNDEF(sxe->iter.data)) {
+ RETURN_FALSE;
+ }
+
+ intern = Z_SXEOBJ_P(&sxe->iter.data);
+ if (intern != NULL && intern->node != NULL) {
+ curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
+ RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name));
+ }
+
+ RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto void SimpleXMLElement::next()
+ Move to next element */
+SXE_METHOD(next)
+{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ php_sxe_move_forward_iterator(Z_SXEOBJ_P(ZEND_THIS));
+}
+/* }}} */
+
+/* {{{ proto bool SimpleXMLElement::hasChildren()
+ Check whether element has children (elements) */
+SXE_METHOD(hasChildren)
+{
+ php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
+ php_sxe_object *child;
+ xmlNodePtr node;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
+ RETURN_FALSE;
+ }
+ child = Z_SXEOBJ_P(&sxe->iter.data);
+
+ GET_NODE(child, node);
+ if (node) {
+ node = node->children;
+ }
+ while (node && node->type != XML_ELEMENT_NODE) {
+ node = node->next;
+ }
+ RETURN_BOOL(node ? 1 : 0);
+}
+/* }}} */
+
+/* {{{ proto SimpleXMLElement SimpleXMLElement::getChildren()
+ Get child element iterator */
+SXE_METHOD(getChildren)
+{
+ php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
+ zval *data;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
+ return; /* return NULL */
+ }
+
+ data = &sxe->iter.data;
+ ZVAL_COPY_DEREF(return_value, data);
+}
+
static zend_object_handlers sxe_object_handlers;
/* {{{ sxe_object_clone()
*/
PHP_MINIT_FUNCTION(simplexml)
{
- zend_class_entry sxe;
+ zend_class_entry ce;
- INIT_CLASS_ENTRY(sxe, "SimpleXMLElement", class_SimpleXMLElement_methods);
- sxe.create_object = sxe_object_new;
- sxe_class_entry = zend_register_internal_class(&sxe);
+ INIT_CLASS_ENTRY(ce, "SimpleXMLElement", class_SimpleXMLElement_methods);
+ sxe_class_entry = zend_register_internal_class(&ce);
+ sxe_class_entry->create_object = sxe_object_new;
sxe_class_entry->get_iterator = php_sxe_get_iterator;
- zend_class_implements(sxe_class_entry, 3, zend_ce_traversable, zend_ce_countable, zend_ce_stringable);
+ zend_class_implements(sxe_class_entry, 3,
+ zend_ce_countable, zend_ce_stringable, spl_ce_RecursiveIterator);
memcpy(&sxe_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
sxe_object_handlers.offset = XtOffsetOf(php_sxe_object, zo);
sxe_class_entry->serialize = zend_class_serialize_deny;
sxe_class_entry->unserialize = zend_class_unserialize_deny;
- php_libxml_register_export(sxe_class_entry, simplexml_export_node);
+ /* TODO: Why do we have two variables for this? */
+ ce_SimpleXMLElement = sxe_class_entry;
- PHP_MINIT(sxe)(INIT_FUNC_ARGS_PASSTHRU);
+ INIT_CLASS_ENTRY(ce, "SimpleXMLIterator", NULL);
+ ce_SimpleXMLIterator = zend_register_internal_class_ex(&ce, ce_SimpleXMLElement);
+
+ php_libxml_register_export(sxe_class_entry, simplexml_export_node);
return SUCCESS;
}
function simplexml_import_dom(DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {}
-class SimpleXMLElement implements Stringable
+class SimpleXMLElement implements Stringable, Countable, RecursiveIterator
{
/** @return array|false */
public function xpath(string $path) {}
/** @return int */
public function count() {}
+
+ /** @return void */
+ public function rewind() {}
+
+ /** @return bool */
+ public function valid() {}
+
+ /** @return ?SimpleXMLElement */
+ public function current() {}
+
+ /** @return string|false */
+ public function key() {}
+
+ /** @return void */
+ public function next() {}
+
+ /** @return bool */
+ public function hasChildren() {}
+
+ /** @return ?SimpleXMLElement */
+ public function getChildren() {}
+}
+
+class SimpleXMLIterator extends SimpleXMLElement
+{
}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: f74d2fc54ca25216f1b54b0776c480d5e8d297fb */
+ * Stub hash: 7b3ff8b991fc7e424aaf1e86cfbebe662a30c48f */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_simplexml_load_file, 0, 1, SimpleXMLElement, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
#define arginfo_class_SimpleXMLElement_count arginfo_class_SimpleXMLElement_getName
+#define arginfo_class_SimpleXMLElement_rewind arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_valid arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_current arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_key arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_next arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_hasChildren arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_getChildren arginfo_class_SimpleXMLElement_getName
+
ZEND_FUNCTION(simplexml_load_file);
ZEND_FUNCTION(simplexml_load_string);
ZEND_METHOD(SimpleXMLElement, getName);
ZEND_METHOD(SimpleXMLElement, __toString);
ZEND_METHOD(SimpleXMLElement, count);
+ZEND_METHOD(SimpleXMLElement, rewind);
+ZEND_METHOD(SimpleXMLElement, valid);
+ZEND_METHOD(SimpleXMLElement, current);
+ZEND_METHOD(SimpleXMLElement, key);
+ZEND_METHOD(SimpleXMLElement, next);
+ZEND_METHOD(SimpleXMLElement, hasChildren);
+ZEND_METHOD(SimpleXMLElement, getChildren);
static const zend_function_entry ext_functions[] = {
ZEND_ME(SimpleXMLElement, getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC)
ZEND_ME(SimpleXMLElement, __toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC)
ZEND_ME(SimpleXMLElement, count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, rewind, arginfo_class_SimpleXMLElement_rewind, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, valid, arginfo_class_SimpleXMLElement_valid, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, current, arginfo_class_SimpleXMLElement_current, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, key, arginfo_class_SimpleXMLElement_key, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, next, arginfo_class_SimpleXMLElement_next, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, hasChildren, arginfo_class_SimpleXMLElement_hasChildren, ZEND_ACC_PUBLIC)
+ ZEND_ME(SimpleXMLElement, getChildren, arginfo_class_SimpleXMLElement_getChildren, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_SimpleXMLIterator_methods[] = {
ZEND_FE_END
};
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "zend_interfaces.h"
-
-#include "php_simplexml.h"
-#include "ext/spl/php_spl.h"
-#include "ext/spl/spl_iterators.h"
-#include "sxe.h"
-#include "sxe_arginfo.h"
-
-PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator = NULL;
-PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
-
-#include "php_simplexml_exports.h"
-
-/* {{{ proto void SimpleXMLIterator::rewind()
- Rewind to first element */
-PHP_METHOD(SimpleXMLIterator, rewind)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- php_sxe_rewind_iterator(Z_SXEOBJ_P(ZEND_THIS));
-}
-/* }}} */
-
-/* {{{ proto bool SimpleXMLIterator::valid()
- Check whether iteration is valid */
-PHP_METHOD(SimpleXMLIterator, valid)
-{
- php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
-
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- RETURN_BOOL(!Z_ISUNDEF(sxe->iter.data));
-}
-/* }}} */
-
-/* {{{ proto SimpleXMLIterator SimpleXMLIterator::current()
- Get current element */
-PHP_METHOD(SimpleXMLIterator, current)
-{
- php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
- zval *data;
-
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- if (Z_ISUNDEF(sxe->iter.data)) {
- return; /* return NULL */
- }
-
- data = &sxe->iter.data;
- ZVAL_COPY_DEREF(return_value, data);
-}
-/* }}} */
-
-/* {{{ proto string SimpleXMLIterator::key()
- Get name of current child element */
-PHP_METHOD(SimpleXMLIterator, key)
-{
- xmlNodePtr curnode;
- php_sxe_object *intern;
- php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
-
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- if (Z_ISUNDEF(sxe->iter.data)) {
- RETURN_FALSE;
- }
-
- intern = Z_SXEOBJ_P(&sxe->iter.data);
- if (intern != NULL && intern->node != NULL) {
- curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
- RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name));
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto void SimpleXMLIterator::next()
- Move to next element */
-PHP_METHOD(SimpleXMLIterator, next)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- php_sxe_move_forward_iterator(Z_SXEOBJ_P(ZEND_THIS));
-}
-/* }}} */
-
-/* {{{ proto bool SimpleXMLIterator::hasChildren()
- Check whether element has children (elements) */
-PHP_METHOD(SimpleXMLIterator, hasChildren)
-{
- php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
- php_sxe_object *child;
- xmlNodePtr node;
-
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
- RETURN_FALSE;
- }
- child = Z_SXEOBJ_P(&sxe->iter.data);
-
- GET_NODE(child, node);
- if (node) {
- node = node->children;
- }
- while (node && node->type != XML_ELEMENT_NODE) {
- node = node->next;
- }
- RETURN_BOOL(node ? 1 : 0);
-}
-/* }}} */
-
-/* {{{ proto SimpleXMLIterator SimpleXMLIterator::getChildren()
- Get child element iterator */
-PHP_METHOD(SimpleXMLIterator, getChildren)
-{
- php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
- zval *data;
-
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
- if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
- return; /* return NULL */
- }
-
- data = &sxe->iter.data;
- ZVAL_COPY_DEREF(return_value, data);
-}
-
-PHP_MINIT_FUNCTION(sxe) /* {{{ */
-{
- zend_class_entry *pce;
- zend_class_entry sxi;
-
- if ((pce = zend_hash_str_find_ptr(CG(class_table), "simplexmlelement", sizeof("SimpleXMLElement") - 1)) == NULL) {
- ce_SimpleXMLElement = NULL;
- ce_SimpleXMLIterator = NULL;
- return SUCCESS; /* SimpleXML must be initialized before */
- }
-
- ce_SimpleXMLElement = pce;
-
- INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", sizeof("SimpleXMLIterator") - 1, class_SimpleXMLIterator_methods);
- ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement);
- ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object;
-
- zend_class_implements(ce_SimpleXMLIterator, 1, spl_ce_RecursiveIterator);
- zend_class_implements(ce_SimpleXMLIterator, 1, zend_ce_countable);
-
- return SUCCESS;
-}
-/* }}} */
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Marcus Boerger <helly@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SXE_H
-#define SXE_H
-
-#include "php.h"
-
-extern PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator;
-extern PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
-
-PHP_MINIT_FUNCTION(sxe);
-
-#endif /* SXE_H */
+++ /dev/null
-<?php
-
-/** @generate-function-entries */
-
-class SimpleXMLIterator
-{
- /** @return void */
- public function rewind() {}
-
- /** @return bool */
- public function valid() {}
-
- /** @return SimpleXMLElement|null */
- public function current() {}
-
- /** @return string|false */
- public function key() {}
-
- /** @return void */
- public function next() {}
-
- /** @return bool */
- public function hasChildren() {}
-
- /** @return SimpleXMLIterator|null */
- public function getChildren() {}
-}
+++ /dev/null
-/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 1ac1e57f7ec3e8a0340b74f0497e1eb9a2b7f663 */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLIterator_rewind, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-#define arginfo_class_SimpleXMLIterator_valid arginfo_class_SimpleXMLIterator_rewind
-
-#define arginfo_class_SimpleXMLIterator_current arginfo_class_SimpleXMLIterator_rewind
-
-#define arginfo_class_SimpleXMLIterator_key arginfo_class_SimpleXMLIterator_rewind
-
-#define arginfo_class_SimpleXMLIterator_next arginfo_class_SimpleXMLIterator_rewind
-
-#define arginfo_class_SimpleXMLIterator_hasChildren arginfo_class_SimpleXMLIterator_rewind
-
-#define arginfo_class_SimpleXMLIterator_getChildren arginfo_class_SimpleXMLIterator_rewind
-
-
-ZEND_METHOD(SimpleXMLIterator, rewind);
-ZEND_METHOD(SimpleXMLIterator, valid);
-ZEND_METHOD(SimpleXMLIterator, current);
-ZEND_METHOD(SimpleXMLIterator, key);
-ZEND_METHOD(SimpleXMLIterator, next);
-ZEND_METHOD(SimpleXMLIterator, hasChildren);
-ZEND_METHOD(SimpleXMLIterator, getChildren);
-
-
-static const zend_function_entry class_SimpleXMLIterator_methods[] = {
- ZEND_ME(SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC)
- ZEND_ME(SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC)
- ZEND_FE_END
-};