Browse Source

- Add ability to add new nodes via properties

migration/RELEASE_1_0_0
Marcus Boerger 21 years ago
parent
commit
b13105ee4c
  1. 5
      ext/simplexml/simplexml.c

5
ext/simplexml/simplexml.c

@ -390,6 +390,7 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
char *name;
xmlNodePtr node;
xmlNodePtr newnode = NULL;
xmlNodePtr mynode;
xmlNodePtr tempnode;
xmlAttrPtr attr = NULL;
int counter = 0;
@ -450,6 +451,8 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
test = 0;
}
mynode = node;
if (node) {
if (attribs) {
if (Z_TYPE_P(member) == IS_LONG) {
@ -510,6 +513,8 @@ next_iter:
change_node_zval(newnode, value TSRMLS_CC);
} else if (counter > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot assign to an array of nodes (duplicate subnodes or attr detected)");
} else if (elements && !node) {
xmlNewChild(mynode, mynode->ns, name, Z_STRVAL_P(value));
} else {
if (attribs) {
switch (Z_TYPE_P(value)) {

Loading…
Cancel
Save